Memory layers for AI agents
Mem0, LangMem, the Claude memory tool, Graphiti, Zep, Cognee and Letta compared on memory model, who writes memories, self-hosting and license, hosted pricing, MCP servers, SDK languages and framework ties.
Comparison
| Entry | Memory model | How memories are written | Self-host and license | Hosted pricing | MCP server | SDK languages | Framework ties |
|---|---|---|---|---|---|---|---|
| Mem0 | Extracted facts in a vector store, scoped by user_id, agent_id and run_id. Graph memory has been removed from the open-source package and is Platform-only | Your app calls add() and an LLM extracts facts. The Platform adds background consolidation (Dream), memory decay and webhooks | Apache-2.0. Use as a library or run the self-hosted server with docker compose (auth on by default) | Hobby free (10k adds and 1k retrievals per month); Starter $19/mo; Pro $249/mo. Graph memory and Dream are listed on Pro and above | Hosted at https://mcp.mem0.ai/mcp, with OAuth sign-in or an API key as a bearer token | Python (mem0ai) and Node (mem0ai), plus a CLI | Framework-agnostic, with a LangGraph integration |
| LangMem | Memories stored as items in a LangGraph BaseStore (for example InMemoryStore or AsyncPostgresStore), searched by namespace | Both: hot-path manage and search tools the agent calls, and a background memory manager. Also does prompt optimization | MIT library; you run it with your own store | No hosted service of its own | None found | Python | Built for LangGraph, through its long-term memory store |
| Claude Memory Tool | Files under a /memories directory that Claude reads and edits | In the conversation: Claude issues view, create, str_replace, insert, delete and rename commands, and your app executes them | Client-side tool, so storage is whatever backend you implement. Your code must reject paths outside /memories | No separate fee; it is a tool type in the Claude API | Not applicable; it is a Claude API tool (type memory_20250818) | Helpers in Python, TypeScript, C# and Java; a local filesystem helper in Python and TypeScript. No helper in Go or Ruby | Claude 4 and later models only |
| Graphiti | Temporal knowledge graph with bi-temporal tracking; outdated facts are invalidated, not deleted | Your app ingests episodes and Graphiti extracts entities and facts incrementally | Apache-2.0, self-hosted only. Needs Neo4j, FalkorDB or Amazon Neptune | None for Graphiti itself; Zep is the managed product from the same team | Experimental Graphiti MCP server: HTTP at localhost:8000/mcp/ or stdio, Docker Compose with FalkorDB by default | Python 3.10+ | Framework-agnostic |
| Zep | Managed context graph built on a proprietary engine (temporal knowledge graph) | Your app sends messages or data as episodes; Zep builds the graph in the background | Managed SaaS or BYOC; proprietary. The getzep/zep repo now holds examples only | Free trial 10k credits/month; Flex $125/mo (50k credits); Flex Plus $375/mo (200k). One credit per episode up to 350 bytes; retrieval and storage free | Context MCP server at https://api.getzep.com/mcp, with end-user sign-in through your IdP; seats vary by plan | Python, TypeScript and Go | Framework-agnostic |
| Cognee | Combined graph, vector and relational memory | Your app calls remember, recall and improve; can run on local models when no LLM key is set | Apache-2.0. API, UI and MCP run locally. Using Postgres as the graph store is for demos; the production option is licensed | Cloud Free $0 (1M tokens, 1 workspace); Standard $1 per 1M tokens plus $5 per extra workspace; Enterprise BYOC | Cognee MCP server (Docker quickstart, port 8001 by default) for Claude Code, Cursor, Codex and others | Python; also an OpenClaw plugin on npm | Framework-agnostic |
| Letta | MemFS: a git-versioned memory filesystem | The agent edits its own memory in the conversation, plus background dreaming | Apache-2.0 (letta-code). Runs locally without an account, or as a self-hosted App Server. The old letta-ai/letta server is retired | Free (BYOK, up to 3 stateful agents); Pro $20/mo (up to 20 agents); developer API plans are usage-based | Hosted Letta MCP server; agents can also connect to stdio, HTTP and SSE MCP servers | TypeScript (Agent SDK); CLI on npm (Node 22.19+) | A full stateful agent runtime, not a plug-in layer |
Verdict: Inside LangGraph, use LangMem. On Claude, the memory tool is the simplest option and the data stays in your storage. Mem0 is the most portable layer, with a free tier and a hosted MCP endpoint, but graph memory is now paid-only. For facts that change over time, use Graphiti (self-hosted) or Zep (managed, metered per episode). Cognee mixes graph and vector memory and runs on local models. Letta is a whole agent runtime that edits its own memory.
How to read this table
Ask two questions first: what shape does a memory take, and who writes it? File-based memory (Claude memory tool, Letta's MemFS) lets the model curate plain text itself. A fact-extraction layer (Mem0, LangMem) turns conversations into short searchable facts. A temporal graph (Graphiti, Zep, Cognee) also records how facts relate and when they stopped being true.
Writing memories during the conversation (the agent calls a tool) makes them visible and easy to debug, but it adds latency and costs tokens. Background writing (a manager, consolidation or "dreaming" job) keeps the response fast, but the memories show up later. LangMem, Mem0 Platform and Letta offer both.
Standout findings
- Mem0 open source no longer includes graph memory. It is a Platform feature, listed on the Pro tier ($249/mo) and above.
- Letta's original server repo is retired. Current development is in
letta-code(Apache-2.0), built around a git-versioned memory filesystem. - Zep is managed or BYOC only. For a self-hosted temporal graph, use Graphiti directly, with its experimental MCP server.
- The Claude memory tool runs on your side. Anthropic stores nothing for it. Your handler decides where the files live and must block path traversal.
Choosing
For a step-by-step build with these tools, see Give an agent long-term memory. If you only need a vector store you control, pgvector or Qdrant under your own extraction logic may be enough. Supermemory is another hosted option that this table does not cover.
Directory entries in this comparison
- Mem0: Memory layer for AI agents and apps: drop-in persistent memory that lets agents learn from past interactions.
- LangMem: LangChain library that helps agents learn from interactions: memory tools, a background memory manager and prompt optimization, with native LangGraph store integration.
- Claude Memory Tool: Client-side Claude API tool that lets Claude create, read, update and delete files in a /memories directory to persist knowledge across conversations.
- Graphiti: Zep's open-source framework for building real-time knowledge graphs for AI agents.
- Zep: Unified context layer that combines business data, documents and conversations into governed context and memory for agents.
- Cognee: Open-source AI memory platform for agents that turns documents and conversations into graph, vector and relational memory.
- Letta: Platform for stateful agents with memory, identity and the ability to learn over time (formerly MemGPT); terminal UI, App Server, desktop app and Agent SDK.
- Graphiti MCP Server: Experimental MCP server exposing Graphiti's temporally-aware knowledge graphs (episodes, entities, semantic/hybrid search) to AI assistants.
- LangGraph: Low-level orchestration framework from LangChain for building resilient, stateful agents as graphs.
- Supermemory: Memory and context engine for AI agents with a Memory API; can run fully locally or hosted.
- pgvector: Open-source vector similarity search extension for Postgres.
- Qdrant: Open-source vector search engine and database written in Rust, self-hosted or as Qdrant Cloud.
Related
- Give an agent long-term memory (Guide)
- Vector databases for agents compared (Comparison)
- Connect an agent to a remote MCP server (Guide)
- Agent identity and MCP authorization platforms (Comparison)
- OpenClaw vs Hermes Agent vs Pi: open-source agents you run yourself (Comparison)
Sources
- Mem0 README, accessed
- Mem0 pricing, accessed
- Mem0 documentation, accessed
- LangMem README, accessed
- Claude docs, Memory tool, accessed
- Graphiti README, accessed
- Graphiti MCP server, accessed
- Zep pricing, accessed
- Zep documentation, accessed
- Cognee README, accessed
- Cognee pricing, accessed
- Letta Code repository, accessed
- Letta documentation, accessed