Originally published May 17, 2026. Substantially updated July 10, 2026. This edition expands our previous comparison with a deeper analysis of memory architectures, temporal facts, real-world scenarios, and deployment trade-offs.
Letta vs Zep/Graphiti vs Mem0: Choosing an AI Agent Memory Architecture
An AI agent can produce an excellent answer today and still forget the entire interaction tomorrow.
That happens because an LLM's context window is working memory, not persistent storage. Passing more chat history into every prompt can preserve context for a while, but it increases latency, cost, and noise—and it still does not solve fact updates, contradictions, or memory lifecycle management.
This guide compares three notable approaches to persistent agent memory:
- Letta — a stateful agent runtime with tiered memory
- Zep / Graphiti — temporal memory built around entities and relationships
- Mem0 — a developer-friendly memory layer for personalization and cross-session recall
We also compare them with the DIY approach of building a custom pipeline on top of a vector database. The goal is to explain how these systems differ, what trade-offs they make, and which architecture is most appropriate for your use case.
Quick Answer
- Choose Letta when your agent should explicitly manage its own persistent state, memory hierarchy, and long-running behavior.
- Choose Zep or Graphiti when temporal facts, entity relationships, provenance, historical queries, and auditability matter.
- Choose Mem0 when you want to add cross-session personalization and memory retrieval to an existing agent with minimal architectural rework.
- Build a custom pipeline when compliance, retention policy, data residency, or domain-specific memory logic are core requirements.
A Note on Product Capabilities
Agent memory tools evolve quickly. Features, APIs, pricing, hosting options, and benchmark results may change between releases. The comparisons below describe the capabilities and architectural patterns available at the time of review. Always verify current documentation before selecting a production dependency.
Why Vector Databases Alone Are Not Agent Memory
Before evaluating dedicated memory systems, it's important to understand why standard Retrieval-Augmented Generation (RAG) is only one piece of the puzzle.
A vector database can retrieve similar text. It does not automatically know whether a fact is current, contradictory, private, important, or worth remembering.
RAG solves "how to find similar content." Dedicated memory systems solve "what to remember, when to update it, and when to forget it."
One User Update, Four Memory Architectures
To see the difference in architectures, consider a simple scenario where a user changes a preference over time:
Scenario:
- January: "I live in Berlin."
- April: "I moved to Tokyo."
- June: "Where do I live now?" / "Where was I living in February?"
| System | Likely Memory Behavior |
|---|---|
| Letta | The agent decides whether and how to overwrite its core memory block using tool calls. |
| Zep / Graphiti | Can preserve both the old and new facts as temporally bounded relationships. |
| Mem0 | Designed to update the current user memory, with historical behavior depending on configuration and implementation. |
| DIY Vector RAG | May retrieve either or both statements unless custom update and temporal logic exists. |
How We Evaluate Memory Systems
We evaluate each tool across five technical dimensions:
- Memory representation: How is data structured (blocks, graphs, vectors)?
- Write and update pipeline: Does the agent write it, or is it automatically extracted?
- Temporal and conflict handling: How does it deal with facts that change over time?
- Retrieval and context assembly: How is memory pulled back into the LLM context?
- Deployment and operational complexity: How hard is it to run in production?
Why This Guide Focuses on Three Tools
This article focuses on Letta, Zep/Graphiti, and Mem0 because they represent three distinct memory architectures:
- agent-managed tiered memory,
- temporal graph memory,
- and memory middleware for existing applications.
Other tools—including knowledge-graph platforms (like Cognee), conversation-memory servers (like Motorhead), and vector-database stacks—can still be strong choices for narrower requirements. See our broader AI Agent Memory Tools guide for a wider market overview.
Head-to-Head Comparison Table
| Dimension | Letta | Zep / Graphiti | Mem0 | DIY Pipeline |
|---|---|---|---|---|
| Primary abstraction | Stateful agent runtime | Temporal memory / knowledge graph | Memory API and personalization layer | Custom data pipeline |
| Memory write path | Agent-directed tool calls | Automatic extraction | Automatic extraction and updates | Build yourself |
| Core memory model | Core, archival, recall | Episodic and semantic graph | Semantic and episodic memory | Depends on design |
| Temporal queries | Limited / implementation-dependent | Strong when using temporal graph features | Usually update-oriented rather than historical | Build yourself |
| Conflict handling | Agent-dependent | Explicit temporal facts | Automated update pipeline | Build yourself |
| Retrieval | Agent tools and archival search | Graph and semantic retrieval | Semantic and filtered retrieval | Vector / hybrid / custom |
| Self-hosting | Available depending on deployment | Graphiti can be self-hosted | OSS/self-hosting options | Full control |
| Operational complexity | Medium to high | Medium to high | Low to medium | High |
| Best fit | Autonomous stateful agents | Enterprise knowledge and history | Fast personalization | Highly custom systems |
Letta — Stateful Agents with Tiered Memory
Philosophy: Treat the context window like virtual memory in an OS. The agent manages its own RAM.
Architecture
Letta provides a runtime where agents explicitly manage tiered memory:
- Core Memory: Always in context. Structured blocks like "Human" (user facts) and "Persona" (agent rules).
- Recall Memory: Short-term conversational history.
- Archival Memory: External storage for deep knowledge, retrieved on demand.
Write Path
Memory is primarily written through agent-directed tool calls. The agent can decide, through memory tools, whether information belongs in core memory, archival memory, or conversation recall.
Read Path
Core memory is injected automatically. For archival memory, the agent explicitly calls search tools to page information into its working context.
Update and Conflict Handling
Because the agent explicitly edits its core memory blocks (e.g., calling core_memory_replace), conflict handling is largely agent-dependent. The system relies on the LLM's reasoning to overwrite outdated facts.
Deployment
Letta offers both self-hosted options and managed cloud services. Because it is an agent runtime, adopting Letta means running your agents inside its loop, which is a significant architectural commitment. Letta's repository is available under the Apache 2.0 license (verify current license for production use).
Conceptual Example
# Conceptual example; check the current Letta SDK for exact API names.
agent = client.create_agent(
name="support-agent",
memory_blocks={
"human": "Name: Unknown. Preferences: Unknown.",
"persona": "I am a helpful assistant."
},
tools=["archival_memory_insert", "core_memory_replace"]
)
# The agent autonomously uses its tools to update its core memory
# when it learns new facts about the user.
Strengths & Limitations
- Strengths: The agent explicitly controls its memory, allowing complex reasoning. Strong support for stateful, long-running agent processes.
- Limitations: Requires adopting Letta as your agent runtime. Memory operations consume additional LLM tokens and tool calls. Less explicit temporal indexing compared to graph-based approaches.
Zep and Graphiti — Temporal Knowledge Graph Memory
Important distinction: Zep Cloud and Graphiti are related but should not be treated as identical products. Zep is the hosted memory product discussed here. Graphiti refers to the open-source temporal knowledge-graph engine associated with this architectural approach. Their capabilities, APIs, deployment models, and product boundaries should be evaluated separately.
Philosophy: Memory is a temporal knowledge graph. Facts have lifespans and relationships.
Architecture
This architecture builds a knowledge graph from interactions, categorizing data into:
- Episodic: Raw interaction data and provenance.
- Semantic: Extracted entities, relationships, and facts.
- Community: High-level structural summaries of the graph.
Write Path
Unlike Letta's agent-driven approach, Zep uses automatic extraction. You pass chat messages or documents into the system, and it asynchronously extracts entities and relationships into the graph in the background.
Read Path
At query time, the system can combine semantic retrieval with graph traversal to retrieve relevant entities, relationships, episodes, and temporally valid facts. The retrieved context should then be filtered by relevance, permissions, provenance, and the time period the agent is being asked about. Exact retrieval behavior depends on the product, deployment, data model, and query configuration.
Update and Conflict Handling
The standout feature is explicit temporal facts. Zep/Graphiti’s temporal modeling is designed to preserve fact validity over time. When a fact changes (e.g., a user moves cities), the old fact isn't simply deleted; it is marked as invalid from that timestamp forward. This supports historically grounded retrieval when configured correctly.
Deployment
Zep Cloud is a managed service, heavily emphasizing enterprise compliance (always check their official Trust page for current SOC 2 Type 2 / HIPAA BAA applicability). Self-hosting is possible via Graphiti, but it requires managing your own compatible graph database infrastructure.
Strengths & Limitations
- Strengths: Temporal modeling for facts that change over time. Graph-based representation of entities and relationships. Can support historically grounded retrieval and audit-oriented workflows when configured correctly. Automatic extraction reduces the amount of memory-tool orchestration required from the agent.
- Limitations: Self-hosting Graphiti carries medium-to-high operational complexity. Cloud versions create vendor reliance. Less granular agent autonomy over exactly how memories are formatted.
Mem0 — Memory Middleware for Personalization
Philosophy: Provide a developer-friendly memory API to add personalization and cross-session recall to existing agents.
Architecture
Mem0 acts as a memory middleware. While architectures vary by deployment, Mem0 can be configured with vector-based memory and, depending on the edition and setup, additional graph or structured-memory capabilities.
Write Path
Mem0 uses automatic extraction and updates. You send conversational turns to the API, and the system handles embedding and categorization under specific namespaces (User ID, Session ID, Agent ID).
Read Path
Semantic retrieval across the user's namespace returns the most relevant facts filtered by relevance and recency.
Update and Conflict Handling
Mem0 provides an automated memory-update workflow intended to identify and consolidate changing user facts. Depending on the model, configuration, and memory store, it may update, merge, retain, or deprioritize older facts when new information conflicts with them. Teams should still evaluate its behavior on ambiguous, domain-specific, and adversarial updates before relying on it for high-stakes state.
Deployment
Mem0 offers both a managed platform (SaaS) and open-source self-hosting options. It can be deployed locally with compatible local models and storage backends (like Ollama and Qdrant) for privacy-sensitive applications.
Conceptual Example
# Simplified example of Mem0 integration
from mem0 import Memory
m = Memory()
# The system automatically extracts facts from the input
m.add(
"I'm Alice. I moved from Berlin to Tokyo last month.",
user_id="alice"
)
# Semantic retrieval filters by user namespace
results = m.search("Where does Alice live?", user_id="alice")
Strengths & Limitations
- Strengths: Fast time-to-market; can be dropped into existing LangChain or CrewAI projects easily. Clear namespacing logic.
- Limitations: Typically prioritizes updating over preserving explicit historical timelines (unlike a bi-temporal graph). The agent does not explicitly orchestrate its memory hierarchy (unlike Letta).
DIY Memory Pipelines — When Full Control Is Worth It
For teams with strict compliance needs or existing infrastructure, building a custom memory pipeline on top of a vector database (like Qdrant, Pinecone, Chroma, or Weaviate) is still a valid approach.
A Minimum Viable Production Architecture
Ingestion → PII/Safety Filter → Fact Extraction → Conflict Detection
→ Temporal Store / Vector Store → Retrieval Policy → Context Assembler
→ Audit Log → TTL / Deletion Worker
When to Build Your Own
For many teams, a dedicated memory layer is cheaper to maintain than rebuilding extraction, updates, and lifecycle management from scratch. Custom implementations still make sense when:
- Operating in high-privacy environments (healthcare, finance, legal).
- You have complex data residency, user-deletion rights, or retention requirements.
- You already operate PostgreSQL, Kafka, Neo4j, or vector databases at scale.
- The memory strategy itself is your core product differentiator.
Production Deployment and Governance Checklist
Choosing a tool is only step one. Use this checklist to ensure your memory architecture is ready for production:
- [ ] Is memory securely namespaced by tenant, user, agent, and session?
- [ ] Are sensitive inputs (PII, passwords) filtered before persistent storage?
- [ ] Can users inspect, correct, export, and delete their stored memories?
- [ ] Are episodic memories subject to TTL (Time-To-Live) and retention policies?
- [ ] Are memory writes logged and auditable?
- [ ] Is retrieval filtered by relevance, recency, permissions, and confidence?
- [ ] Have you tested prompt injection and memory-poisoning attempts?
- [ ] Do you need current-state answers, historical-state answers, or both?
- [ ] Can the system distinguish a user preference from an untrusted instruction?
- [ ] Is there an evaluation set for memory precision, recall, update accuracy, and leakage?
Which Tool Should You Choose?
There is no universal best memory system for AI agents.
- Choose Letta when the agent itself should actively manage persistent state and memory.
- Evaluate Zep or Graphiti when temporal facts, entity relationships, provenance, and auditability are central requirements.
- Choose Mem0 when you want to add cross-session personalization to an existing agent with minimal architectural work.
- Build a Custom Pipeline when you need full control over schemas, retention, privacy, retrieval, or domain-specific memory policies.
The important distinction is not whether a tool uses vectors, graphs, or key-value storage. It is whether the system gives you reliable control over what gets remembered, how memories change, how they are retrieved, and when they should be removed.
Frequently Asked Questions (FAQ)
What is the difference between semantic, episodic, and temporal memory?
- Episodic memory records the raw "who said what and when" (conversation logs).
- Semantic memory extracts the underlying facts and entities ("Alice lives in Berlin").
- Temporal memory tracks the validity of those facts over time ("Alice lived in Berlin until April, then moved to Tokyo").
How should AI agents handle memory poisoning?
Treat all candidate memories as untrusted input. Separate user facts from executable instructions, validate high-impact writes, attach provenance, apply TTLs where appropriate, and evaluate the system against prompt-injection and poisoning scenarios.
Is a vector database enough for agent memory?
Usually, no. While vector databases are excellent for semantic retrieval, they do not natively handle fact updates, contradiction resolution, or temporal tracking—features required for true agent memory.
Related Tools and Guides
- Letta (formerly MemGPT) - Full Review & Architecture
- Mem0 - The Complete Memory Layer for AI Agents
- Zep - Fast, Scalable Memory for LLM Apps
- Graphiti - Knowledge Graph Memory
Explore hundreds of curated AI agent tools, frameworks, vector databases, and infrastructure at AgDex.ai.
Published by the AgDex.ai editorial team. Building something cool with agent memory? Drop a comment — we'd love to feature your use case.
Top comments (0)