Structured Memory
Overview of the Structured Memory API
Structured Memory stores typed records, called entries, that a workflow can read as context and write as results.
- A bucket groups entries under a key you choose, such as one bucket per
supplier (
supplier-1042). - A kind names a category of entry, such as
supplier-profileorinvoice. Each kind has numbered versions. A version fixes the JSON Schema that entryattributesmust match, and its file rule says whether each entry holds one file (a PDF or an image). - An entry is identified by its bucket, its kind, and its key (
INV-2041). Entries are write-once: to replace one, delete it and create it again.
A workflow uses memory through two function types. A read_memory node sends
the entries a call selects to an Extract as context. A write_memory node saves
the Extract output as a new entry and produces a write_memory event. A call
names what it reads and where it writes in its memory input, with Memory URIs
such as bem://memory/buckets/supplier-1042?kind=invoice.
Lists page by key: pass the last key (or name for kinds) of a page as
startingAfter to get the next page. limit is 1 to 200, default 50.
A failed request returns a body such as
{"error": "memory bucket \"supplier-1042\" not found", "code": "MEMORY_BUCKET_NOT_FOUND"}.
MemoryErrorV3 lists the codes.
See also
- Structured Memory guide — worked example, Memory URIs, limits, error codes