--- title: "Agent memory layer: what it is and how it works" description: "An agent memory layer stores what agents learn outside the model and returns the relevant part on each call. Its parts, its limits, and how to choose one." canonical: https://past.dev/agent-memory-layer last-updated: 2026-12-04 --- # What is an agent memory layer? Source: https://past.dev/agent-memory-layer An agent memory layer is a service that sits between your agents and their sources. It ingests what happens, such as messages, meetings, documents and tool results, and stores it outside the model. On each call it returns the part that matters for the request. The model stays stateless and the layer keeps the history, so the agent remembers across sessions, tools and models. ## Where the memory layer sits An agent stack has three parts. The model answers one call at a time and keeps nothing. The framework or harness runs the loop: prompts, tools and retries. The memory layer keeps what the agent learned and supplies it to the next call. | Part | Keeps state | Examples of its job | | --- | --- | --- | | Model | No | Reads the prompt and returns an answer | | Framework or harness | For the current task | Plans, calls tools, assembles the prompt | | Memory layer | Across sessions, agents and models | Ingests history, resolves who and what it is about, recalls the relevant part | Because the layer is separate, you can change the model or the framework and keep the memory. ## What a memory layer does 1. **Ingest.** Accept data points with their time and source: chat turns, emails, meeting transcripts, tickets, tool output. 2. **Extract.** Turn each data point into memories: facts, events, decisions and preferences, with their speaker. 3. **Resolve.** Link mentions of the same person, company or project across sources to one entity. 4. **Update.** When a fact changes, keep the new value as current and the old value with its period. 5. **Recall.** Return the memories that answer the request, with their sources, within a token budget. 6. **Forget.** Delete a source and every memory drawn from it. ## Memory layer vs context window, RAG and fine-tuning | Approach | What it keeps | Where it falls short for agents | | --- | --- | --- | | Long context window | Everything you resend on each call | Input cost grows with history, and irrelevant or outdated content competes with the answer | | RAG over a corpus | Documents you curated | Read only: it does not record what the agent learns or which fact replaced which | | Fine-tuning | Patterns in the model weights | Slow to update, cannot delete one record, and cannot cite a source | | Memory layer | The agent's history, as facts with time and source | Adds an ingestion step and a recall call to each request | These approaches combine. A memory layer often feeds a context window, and an agent can use RAG over manuals and memory over its own history. [Agent memory vs RAG](/what-is-agent-memory#agent-memory-vs-rag) and [context engineering](/context-engineering) go further. ## How to choose an agent memory layer - **Accuracy at your scale.** Test recall on a history the size of yours. Accuracy measured on a short history does not predict accuracy on millions of tokens. Public benchmarks such as BEAM test sizes up to 10M tokens; see [how we measure memory](/benchmarks). - **Changed facts.** Ask what the layer returns after a value is updated: the current value, the old one, or both without dates. - **Sharing and access.** Check whether several people and agents can share one memory with per reader visibility. See [multiplayer agent memory](/multiplayer-agent-memory). - **Sources.** Each recalled memory should link to the data point it came from. - **Cost.** Count the cost of ingestion and of each recall, and the input tokens recall adds to each call. - **Deletion.** Deleting a source should remove every memory drawn from it. - **Integration.** Check the API, the SDKs and the MCP server against the agents you run. ## past.dev as a memory layer past.dev is a long-term memory layer for agents. You send data points to `POST /api/v1/ingest` and call `POST /api/v1/recall` before each request, or connect an agent through the MCP server or a plugin. It sits on top of your existing stack: the model, the framework and the data stores stay as they are. Start with the [quickstart](/docs/memory-api/quickstart), or read [how it works](/docs/memory-api/how-it-works). ## Frequently asked questions ### What is an agent memory layer? A service outside the model that ingests what agents see and do, stores it as memories with time and source, and returns the relevant part on each call. ### Is a memory layer the same as a vector database? No. A vector database stores embeddings and returns similar items. A memory layer also extracts facts, resolves entities, tracks which value is current, and deletes by source. It may use a vector index inside. See [vector database vs memory](/vector-database-vs-memory). ### Do I need a memory layer if my model has a long context window? For agents that run over weeks or across many sources, yes. Resending the full history raises input cost on every call, and older or conflicting content competes with the answer. A memory layer sends the relevant part. ### Can several agents share one memory layer? Yes, if the layer scopes each write and filters each read by identity. See [multiplayer agent memory](/multiplayer-agent-memory). ### How do I add a memory layer to an existing agent? Send the agent's history to the layer's ingest endpoint, and call recall before each model call. With past.dev, the [quickstart](/docs/memory-api/quickstart) covers both calls. ## Related - [What is agent memory?](https://past.dev/what-is-agent-memory) - [What is multiplayer agent memory?](https://past.dev/multiplayer-agent-memory) - [Best memory layers for AI agents](https://past.dev/blog/best-memory-layers-for-ai-agents) - [Vector database vs graph database vs memory](https://past.dev/vector-database-vs-memory) - [Context engineering for AI agents](https://past.dev/context-engineering) - [Memory API quickstart](https://past.dev/docs/memory-api/quickstart)