Memory
Memory lets an agent remember what matters across conversations. This guide explains the parts of memory and how they work together. It also shows how to set memory up.
Why memory
If you put the whole history in the prompt, the prompt grows every turn. A longer prompt costs more tokens. Memory keeps what matters in a store that the agent can search. The store works across conversations.
The pieces
| Piece | Where it is set | What it does |
|---|---|---|
| Embedding Profile | On a Model Provider | Turns text into vectors. |
| Memory Store | On the Mesh | Holds documents, facts and observations. |
| Interaction Profile | On the Agent | Reads and writes the store. |
| Request tags | On each request | Select whose memories apply. |
What the store holds
A Memory Store holds four kinds of record.
- Documents are conversation turns, stored word for word.
- Chunks are the searchable pieces of documents.
- Facts are single claims. Each fact is World or Experience, Stated or Inferred, and Active or Merged.
- Observations are claims that the store builds from facts. Observations are the long-term memory.
Scopes
A scope sets how the store groups what it keeps.
- A Sliced scope keeps one set of memories for each tag value. For example, it keeps one set for
user=aliceand one set foruser=bob. - An Unsliced scope keeps one set of memories.
Each scope reads either everything or only tagged content. Each scope files what it produces under a key and a value. Interaction Profiles select memories by that key and value.
The pipeline
The store processes content in four steps.
- Ingest. The store saves conversation turns as chunks, as the conversation happens.
- Index. When the store indexes by semantic meaning, it makes embeddings for the chunks.
- Extract. On the extraction interval, a model reads the new chunks and writes facts.
- Consolidate. On the consolidation interval, a model merges facts into observations.
Agents can also write facts directly with write tools.
Wiring it up
- Add an Embedding Profile to a Model Provider.
- Create a Memory Store. Turn on Ingest conversations. Set indexing to semantic meaning. Select the Embedding Profile. Add a Sliced scope with the key
user. - Set the Memory Store on the Mesh.
- Create an Interaction Profile. Add Conversation history with the newest turns and a budget of 2000 tokens. Add a Context injection of Facts and Observations that are tagged
user. Take the tag value from the request taguser. - Attach the Interaction Profile to the Agent.
- Tag each request with
user=alice. In the Conversation API, set"tags": [{"name": "user", "value": "alice"}]in the body. In AG-UI, send the headerPartite-Request-Tags: user=alice.
Checking what the agent sees
The Recall tab on the Memory Store runs the same search that the agent runs. The trace timeline shows Memories items and Conversation history items. Each item shows what the request injected into the prompt.
Tips
- Keep token budgets small. Raise them when the results show you need more.
- Use one store for each Mesh. Design scopes, not stores.
- Name tags the same way in all Meshes.