AI agent memory is the layer that lets an agent remember facts, preferences and past events across conversations, instead of starting from zero each session. The three best-known options take different approaches. Mem0 is a memory layer you add to any agent: it extracts facts from conversations and retrieves the relevant ones later. Letta is an agent runtime built around memory, where agents edit their own memory blocks. Zep is a managed context platform built on Graphiti, an open-source temporal knowledge graph that tracks how facts change over time.
If your framework already has a memory store, you may not need any of them. This guide explains the types of memory, compares the three tools, and shows when LangGraph's built-in memory is enough. Details reflect each project's documentation as of October 5, 2026; the Mem0 code below was checked against mem0ai 2.2.1.
What AI agent memory actually means
Most agent frameworks separate memory into two kinds.
Short-term memory is the conversation so far: the messages, tool calls and intermediate state of one session or thread. It usually lives in the context window and in a checkpoint store, so you can resume a session later.
Long-term memory persists across sessions. It is often split into three types. Semantic memory holds facts ("Alex is vegetarian"). Episodic memory holds past events ("last week Alex asked about refunds"). Procedural memory holds learned instructions ("always reply in Spanish to this user").
A memory system has to decide what to save, how to store it (vectors, a graph, files or plain records), and what to retrieve at the moment of each request. Those three choices are where Mem0, Letta and Zep differ.
Mem0 vs Letta vs Zep at a glance
| Item | Mem0 | Letta | Zep |
|---|---|---|---|
| What it is | A memory layer for any agent | An agent runtime with memory at its core | A managed context platform |
| How memory is stored | Extracted facts in a vector store, plus history | Memory blocks and a git-versioned memory filesystem | A temporal knowledge graph (Graphiti) |
| Who decides what to remember | Mem0's extraction pipeline | The agent itself, plus background subagents | Zep's ingestion into the graph |
| Open source | Yes, Apache-2.0 | Yes | Graphiti is open source (Apache-2.0); Zep is a managed service |
| Hosted option | Mem0 Platform | Letta Cloud | Zep Cloud |
| Best for | Adding personalization to an existing agent | Long-lived, stateful agents | Facts that change over time, enterprise data |
In short: choose Mem0 to bolt memory onto an agent you already have. Choose Letta when the agent itself should manage its memory over a long life. Choose Zep, or Graphiti on its own, when you need to know not just what is true but when it became true.
Mem0: a drop-in memory layer
Mem0 is the easiest way to add long-term memory to an existing agent. You pass it conversation messages, it uses a model to extract memorable facts, and you search those facts before the next response. The open-source library works with no extra infrastructure. By default it uses OpenAI for extraction and embeddings, a local Qdrant store on disk and SQLite for history, so you only need an OPENAI_API_KEY to start.
from mem0 import Memory
m = Memory()
m.add(
[
{"role": "user", "content": "I'm vegetarian and allergic to peanuts."},
{"role": "assistant", "content": "Noted. I'll keep that in mind."},
],
user_id="alex",
)
hits = m.search("What should I cook for Alex?", filters={"user_id": "alex"})
print(hits)
You can scope memories by user_id, agent_id or run_id, attach metadata and set expiration dates. You can swap in a different model provider or vector store, and the self-hosted server uses Postgres with pgvector. The Mem0 README describes an April 2026 update to the memory algorithm, with add-only extraction, entity linking and retrieval that combines several signals. The managed Mem0 Platform adds hosting, dashboards and enterprise features.
Pros: works with any framework, a few lines to integrate, flexible storage backends and a permissive license.
Cons: extraction calls a model on every add, which adds cost and latency, and quality depends on the model and prompts you use.
Who it's for: teams that want to add personalization to a chatbot or agent built with any framework, without changing how the agent works.
Letta: agents that manage their own memory
Letta began as MemGPT, a research project on giving language models an operating-system-style memory hierarchy. Letta treats memory as part of the agent, not a separate service. Agents have memory blocks pinned in context, such as a persona and facts about the user, and they edit those blocks themselves with tools. Older context is moved out to searchable storage.
The project has changed shape recently, so check which version a tutorial is using. Active development is now in Letta Code, installed with npm install -g @letta-ai/letta-code and run with the letta command. letta server starts a local runtime that needs no account. Letta's newer features include MemFS, a git-versioned memory filesystem, and sleep-time agents that reorganize memory in the background between conversations. There is a TypeScript Agent SDK and a hosted Letta Cloud. The earlier V1 API server repository is archived.
Pros: memory is a first-class part of agent design, agents can improve their own memory over time, and versioned memory makes changes auditable.
Cons: you adopt Letta's runtime rather than adding a library to your own agent, and the recent restructuring means many older guides and examples are out of date.
Who it's for: builders of long-lived assistants and coding agents that should accumulate knowledge over weeks or months.
Zep and Graphiti: memory as a temporal graph
Zep stores memory as a knowledge graph. Its open-source engine, Graphiti, turns conversations and business data into entities, relationships and facts, and each fact has a validity window. When a user says they moved from Boston to Denver, the old fact is marked as no longer valid instead of being deleted, so the agent can answer both "where does Alex live?" and "where did Alex live in 2025?" Retrieval combines semantic search, keyword search and graph traversal.
Zep packages Graphiti as a managed context platform with user and session management and enterprise controls. According to Zep's pricing page, there is a free plan with 10,000 credits a month, paid self-serve plans billed by the size of the data you send, and Enterprise plans that can run inside your own cloud. If you want to self-host without Enterprise, use Graphiti directly (pip install graphiti-core) with Neo4j, FalkorDB or Amazon Neptune; the Graphiti repository lists supported versions. See the Zep documentation for current features.
Pros: handles changing facts correctly, combines chat history with structured business data, and graph queries can answer relationship questions that vector search alone misses.
Cons: graphs are more complex to run and reason about than a vector store, and the full Zep platform is a hosted service unless you are on an Enterprise plan.
Who it's for: enterprise assistants, CRM and support agents, and any domain where facts change and history matters.
When LangGraph's built-in memory is enough
Before adding a memory service, check what your framework already does. LangGraph separates memory the same way this guide does. A checkpointer saves short-term thread state after every step, and a store holds long-term memories across threads, with optional semantic search. The LangGraph memory docs show both. If your needs are "remember this user's preferences and search them," a store backed by Postgres may be all you need. Our LangGraph vs CrewAI vs OpenAI Agents SDK guide compares how each framework handles state.
Add a dedicated memory tool when you need automatic fact extraction (Mem0), agents that curate their own memory (Letta) or time-aware facts (Zep).
How to choose AI agent memory
- Do you already have an agent and just want it to remember users? Start with Mem0.
- Is the agent itself the product, running for months and learning as it goes? Look at Letta.
- Do facts change, and does the agent need to know when? Use Zep or Graphiti.
- Is your framework's built-in store enough? Try it first, then add a tool if extraction or retrieval quality falls short.
Whatever you choose, treat memory as user data. Give users a way to view and delete what is stored, scope memories per user, and don't save secrets. Many teams also expose memory as tools over the Model Context Protocol, so the same memory works in coding agents and chat clients; see MCP vs A2A for how MCP fits into agent architecture.
Related guides: pair memory with web access using Tavily vs Exa vs Firecrawl, and with safe code execution using E2B vs Daytona vs Modal.
FAQ
What is AI agent memory?
It is the system that lets an agent keep information beyond a single conversation. Short-term memory covers the current session. Long-term memory stores facts, past events and learned instructions that are retrieved in later sessions.
What is the difference between Mem0 and Letta?
Mem0 is a memory layer you add to any agent: it extracts facts from messages and returns relevant ones on search. Letta is an agent runtime where memory is built in and agents edit their own memory blocks. Use Mem0 to add memory to an existing agent, and Letta when you want the whole agent built around memory.
What is the difference between Mem0 and Zep?
Mem0 stores extracted facts mainly in a vector store and retrieves them by relevance. Zep stores memory as a temporal knowledge graph using Graphiti, so it tracks relationships and when each fact was valid. Zep is a better fit when facts change over time.
Is Letta the same as MemGPT?
Yes. Letta is the project and company that grew out of the MemGPT research. Active development has moved to Letta Code, and the older V1 server repository is archived.
Can I self-host agent memory?
Yes. Mem0's open-source library and server can be self-hosted, Letta runs locally without an account, and Graphiti, the engine behind Zep, is open source. Zep's full platform is a managed service, with a bring-your-own-cloud deployment available on Enterprise plans.
Do I need a vector database for agent memory?
Usually yes, for semantic recall. Mem0 uses Qdrant locally by default and supports many others, including pgvector. Graph-based memory like Graphiti uses a graph database, and LangGraph's store can add semantic search on top of Postgres.



