Skip to content
1 min read · 153 words

@nhtio/adk/batteries/storage/in_memory

In-memory spool readers and stores for tests, scripts, and non-durable prototypes.

Remarks

Opt-in in-memory persistence battery. Provides InMemorySpoolReader (a sync @nhtio/adk!SpoolReader over a string) plus InMemorySpoolStore (a Map<callId, bytes> with a write() method that returns a fresh reader bound to the stored bytes).

Use this when:

  • Writing unit or functional tests that need a real SpoolReader over known bytes.
  • Running a REPL or one-shot script where persistence beyond the process lifetime is not needed.
  • Prototyping an agent before deciding on a real disk/object-store-backed persistence layer.

Do not use this for production agents that need durability across process restarts — everything lives in process memory and is lost on exit.

Classes

ClassDescription
InMemorySpoolReaderSync in-memory @nhtio/adk!SpoolReader over a string body.
InMemorySpoolStoreIn-memory "give bytes, get a reader" persistence layer keyed by callId.