How an agent writes something to the account's memory, searches it later, and takes a write back out. What memory is and what it costs is on Services.
Memory is one graph for the whole account, shared by all of your agents. It is on from the start and needs no setup. An agent uses it with its Passport. You use it with your key or sign-in.
Remember that Anna at Acme prefers email and is out until the 20th.The client calls stack_memory_add_memory. From code or the terminal:
const write = await stack.memory.addMemory({
name: 'Call note',
episode_body: 'Anna at Acme prefers email and is out until the 20th.',
}, { passportToken });
// write.uuid, write.status === 'queued'npx @getstackrun/cli memory add "Anna at Acme prefers email." --name "Call note"Text that looks like a password, a key or a card number is refused and never stored. Text is also scanned for attacks: with controls on, flagged text is refused, except a memory or fact you write yourself, and with controls off it is stored with its flag.
What do we know about Anna at Acme?const people = await stack.memory.searchNodes({ query: 'Anna' }, { passportToken });
const facts = await stack.memory.searchMemoryFacts({ query: 'How does Anna want to be contacted?' }, { passportToken });const history = await stack.memory.getHistory({}, { passportToken }); // each write, with its id
await stack.memory.undoWrite(writeId, { dryRun: true }, { passportToken }); // see what would change
await stack.memory.undoWrite(writeId, {}, { passportToken });You can add your own kinds of things with their own fields, for example a contract with a renewal date, so they are picked out of what is written. The tools are stack_memory_create_entity_type, stack_memory_update_entity_type and stack_memory_retire_entity_type. From the terminal: memory type-add.
npx @getstackrun/cli memory settings --enabled offOnly the owner or an admin changes the settings. The second setting, call_memory_access, decides whether a phone call that STACK holds may search memory while it talks. The transcript of such a call is written to memory when it ends.
Writing an entry, writing a fact and summarising are one action each. Searching, reading, deleting, undoing and the settings are free. Reading a write into the graph uses a model, which is charged at cost after the writes the plan includes each month.
Every field is on Memory in the API reference. Every tool is in the tool reference. To search your documents, not what agents wrote, see Brain.