Skip to content
Memory

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

PieceWhere it is setWhat it does
Embedding ProfileOn a Model ProviderTurns text into vectors.
Memory StoreOn the MeshHolds documents, facts and observations.
Interaction ProfileOn the AgentReads and writes the store.
Request tagsOn each requestSelect 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=alice and one set for user=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.

  1. Ingest. The store saves conversation turns as chunks, as the conversation happens.
  2. Index. When the store indexes by semantic meaning, it makes embeddings for the chunks.
  3. Extract. On the extraction interval, a model reads the new chunks and writes facts.
  4. Consolidate. On the consolidation interval, a model merges facts into observations.

Agents can also write facts directly with write tools.

Wiring it up

  1. Add an Embedding Profile to a Model Provider.
  2. 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.
  3. Set the Memory Store on the Mesh.
  4. 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 tag user.
  5. Attach the Interaction Profile to the Agent.
  6. Tag each request with user=alice. In the Conversation API, set "tags": [{"name": "user", "value": "alice"}] in the body. In AG-UI, send the header Partite-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.

Related