AI agent memory: the best memory layers for agents in 2026
Seven memory layers compared on what an agent really needs: what it keeps, how it updates a fact, where it runs, and what each write costs.
AI agent memory is the layer that lets an agent remember across sessions: it extracts what matters from conversations and data, stores it outside the prompt, updates it when facts change, and feeds the right pieces back before each answer. The short answer: Mem0 is our top pick to add memory to an agent you already run. Zep is the pick when facts change over time, Supermemory for a hosted API with connectors, Cognee for open-source graph memory on your own stack, Hindsight for pay-as-you-go memory that learns, Letta for agents that manage their own context, and LangMem if you already build on LangGraph.
Some links are affiliate links. The ranking is editorial: a sponsored placement is always labeled on its card, and no affiliate link changes a score.
Seven agents, seven winners
Free plan, unlimited end users
Facts that change: plans, owners, ticketsTemporal graph, reads at 0 credits
Memory plus documents and inboxesPro $19/mo with $20 of usage
Graph memory on your own serversApache 2.0, 100M tokens free in the cloud
No monthly fee, pay per operationMIT server, $5 of free credit
An agent that curates its own contextMemory blocks the agent edits
An agent already built on LangGraphMIT library, no vendor bill
The 7 best AI agent memory tools
The seven tools below store what an agent learns and give it back in a later session. What separates them is the memory model (extracted facts, a temporal graph, blocks the agent edits), where you can run it, and the unit you pay for. We compared them for a developer adding long-term memory to a production agent, not on their full feature lists.
Five sub-scores make the score, averaged: setup in an existing agent, memory updates and recall, self-hosting and license, free tier and price clarity, docs and integrations. The memory model column is the one to read first, because it decides how the tool handles a fact that changes.
| Best for | Memory model | Free plan | Team size | Visit | ||||
|---|---|---|---|---|---|---|---|---|
| 1 | Mem0 | Best memory layer to add to an agent you already have | Extracted facts per user; Apache 2.0 | 4.6/5 | Free; Custom on quote | ✓ | Solo to enterprise | Visit → |
| 2 | Zep | Best for facts that change over time | Temporal graph; pay only to write | 4.2/5 | Free; Flex $125/mo | ✓ | Startups to enterprise | Visit → |
| 3 | Supermemory | Best hosted memory API with connectors | Memory plus connectors; engine closed | 4.0/5 | Free; Pro $19/mo | ✓ | Solo to mid-size | Visit → |
| 4 | Cognee | Best open-source graph memory on your own stack | Graph from your data; Apache 2.0 | 3.8/5 | Free; Premium $99/mo | ✓ | Data teams | Visit → |
| 5 | Hindsight | Best pay-as-you-go memory that learns from experience | Retain, recall, reflect; MIT | 3.6/5 | Free self-host; pay as you go | ✓ | Solo to mid-size | Visit → |
| 6 | Letta | Best for agents that manage their own memory | Agent edits its own blocks | 3.6/5 | Free; Pro $20/mo | ✓ | Agent builders | Visit → |
| 7 | LangMem | Best for teams already on LangGraph | Library inside LangGraph; MIT | 3.2/5 | Free (MIT) | ✓ | LangGraph teams | Visit → |
Is your tool missing from this page? Email us: hello@hackceleration.com
Mem0
Mem0 is a memory layer, not an agent runtime. You keep your agent, your model and your framework; after each exchange you send the messages to Mem0, which extracts the facts worth keeping (a preference, a name, a decision) and stores them under a user, a session or an agent. Before the next answer, you search those memories and paste the best ones into the prompt. That design is why it fits in an afternoon. To call it from a no-code flow or from Claude, see the Mem0 integration for Make and the Mem0 integration for Claude.
The open-source version is Apache 2.0 and runs the same memory engine as the hosted platform. Its library defaults to OpenAI models (gpt-5-mini for extraction and text-embedding-3-small for embeddings) with a local Qdrant store, so plan an OpenAI key or swap the provider in the config. The hosted Free plan counts in adds and retrievals: 10,000 adds and 1,000 retrievals a month while Mem0 pays the model calls during your first 30 days, then 50,000 adds and 10,000 retrievals once you plug in your own LLM key. Graph memory (entity linking), user profiles, Dream consolidation and on-prem deployment sit on the Custom plan, whose price is set in your agreement.
The limit is memory hygiene. In a public discussion on the Mem0 repository in 2026, users explained that the built-in check after extraction catches exact duplicates by hash, so a reworded fact usually lands as a new row; in 2025 another developer reported that some needed facts were silently not saved, with no error from the add call. Read back what Mem0 stored during your first week, and keep the raw transcript somewhere you control.
- User, session and agent scopes out of the box
- Apache 2.0 engine you can self-host
- Free plan with unlimited end users
- ✓Fastest way to add memory to an existing agent
- ✓Same engine hosted or self-hosted
- ✓Integrations with the main agent frameworks
- ✗Reworded duplicates can pile up
- ✗Graph memory and Dream only on the Custom plan
- ✗Paid plan priced on quote
The default pick to give an existing agent long-term memory this week. Audit what it stores before you trust it with users.
Zep
Zep stores memory as a temporal knowledge graph. Each message or document you send becomes an episode; Zep extracts entities and the relations between them, and when a new fact contradicts an old one, the old fact is invalidated instead of deleted, so the agent knows what is true now and what was true before. For an agent that follows a customer for months, that is the difference between "your plan is Pro" and "your plan was Pro until you downgraded".
The engine underneath, Graphiti, is open source under Apache 2.0. Running it yourself means running a graph database (Neo4j, FalkorDB, Amazon Neptune with OpenSearch, or the embedded Relate option), and Graphiti works best with models that support structured output. The full Zep service is a cloud product: the public zep repository now holds examples and integrations for Zep Cloud, and the closest thing to self-hosting is the Enterprise option to deploy inside your own VPC.
Pricing is simple once you know the unit. Only writing costs: 1 credit per episode up to 350 bytes, plus 1 credit per extra 350 bytes, and an eighth of a credit per webhook call. Retrieval, storage, threads, users and graph storage cost 0 credits. Flex is $125 a month billed monthly with 50,000 credits, then $25 per 10,000 credits; Flex Plus is $375 with 200,000 credits.
- Temporal graph that keeps the history of each fact
- Retrieval and storage at 0 credits
- Graphiti engine under Apache 2.0
- ✓Handles contradicting facts cleanly
- ✓Billing only on writes, easy to forecast
- ✓Graphiti is reusable outside Zep
- ✗Full service is cloud or your VPC on Enterprise
- ✗Self-hosting Graphiti needs a graph database
- ✗Long messages cost several credits each
The pick when your agent must know which fact is current. Size your messages before choosing a plan: credits count bytes.
Supermemory
Supermemory is a hosted memory and retrieval API. You add conversations, files or connected sources, and your agent searches them back through one endpoint, with plugins for coding agents and assistants. Its plans are a monthly balance in dollars rather than a quota of calls: every plan pays the same rates, and the plan decides how much usage comes included.
The meters are what you need to read. Memory ingestion costs $5 per million SM tokens of plain text ($10 for rich content), SuperRAG ingestion $1 per million tokens of text, and search $5 per million queries. Supermemory gives its own example: an app with 1,000 users who each add 20,000 tokens of conversation and run 200 searches comes to about $101 a month at list rates, inside the $130 of usage that Max includes. Subscription credits reset every month; top-up credits never expire.
Watch the word open source. The main repository, the MCP server and the plugins are MIT, and the SDKs are Apache 2.0, but the memory engine itself is not open source. What you can run yourself is supermemory local, a free self-hosted binary capped at 10,000 stored documents; your own cloud or a dedicated instance starts on the Scale plan.
- One API for memory, files and connectors
- Same rates on every plan
- Top-up credits never expire
- ✓Quick to wire into an assistant or coding agent
- ✓Clear published rates per million tokens
- ✓Free local binary for small projects
- ✗Memory engine is not open source
- ✗Four meters to forecast
- ✗Own-cloud deployment starts at $399/mo
The fastest hosted option when memory also has to read documents and mailboxes. Not the pick if you need the engine's source.
Cognee
Cognee builds memory from data rather than from chat alone. You feed it documents, conversations or sources such as Slack, Notion, Linear or Google Drive; it extracts entities and relations into a graph, keeps embeddings next to it, and your agent searches both. It ships an MCP server, so coding agents like Claude Code or Codex can use the same memory.
The engine is open source under Apache 2.0 and free to run locally or on your own stack. Cognee Cloud has an unusually generous entry point: the Standard plan is $0 a month with 100 million tokens included, then $0.10 per million, one workspace included and more at $5 each per month, with unlimited users and API calls. Premium is $99 a month plus token usage and adds an ontology editor and entity types learned from your data. Enterprise is delivered in your own cloud.
The cost is setup. Cognee asks you to decide what to ingest and how to structure it before retrieval pays off, which is more work than sending chat turns to an API. It fits a team with a data engineer and a corpus, less a solo developer who wants a chatbot to remember a first name.
- Graph plus vector memory from your own data
- Apache 2.0, runs locally
- 100M tokens free on Cognee Cloud
- ✓Full self-hosting with no license fee
- ✓Connectors for team tools
- ✓MCP server for coding agents
- ✗More setup than a chat memory API
- ✗Graph modeling takes thought
- ✗Premium features cost $99/mo plus usage
The pick for teams that want graph memory over their own documents, self-hosted. Budget setup time, not license fees.
Hindsight
Hindsight, made by Vectorize, organizes memory around three operations: retain (store what happened), recall (fetch what is relevant) and reflect (synthesize patterns from past experience into what it calls observations and mental models). The goal is an agent that changes its behavior from what it lived, not one that only quotes old messages back.
The server is MIT and self-hosts with a single Docker command, with an LLM wrapper and integrations for common agent frameworks and coding agents. Hindsight Cloud has no monthly fee and no seats: retain costs $10 per million tokens, recall $0.75 per million tokens, reflect $0.05 per call, and memories held past their first 30 days cost $0.25 per million tokens per month. New accounts start with $5 of free credit.
Read the unit before you estimate. Writing is the expensive side here: retaining is more than thirteen times the price of recalling per million tokens, so an agent that stores every turn verbatim pays far more than one that stores a summary. Its benchmark results come from Vectorize and were reproduced by the research collaborators it names, the Virginia Tech Sanghani Center and The Washington Post; run your own multi-session cases before you choose on accuracy.
- Retain, recall and reflect operations
- MIT server, one Docker command
- No monthly fee on the cloud
- ✓Pay only for what the agent does
- ✓Self-hosting with no license cost
- ✓Reflection builds reusable mental models
- ✗Writes cost much more than reads
- ✗Younger ecosystem than Mem0
- ✗Benchmarks run by the vendor and its partners
A strong choice for agents that should learn from past runs, self-hosted or pay as you go. Store summaries, not raw turns.
Letta
Letta, formerly MemGPT, is an agent platform rather than a memory add-on. Its agents hold memory blocks that sit in the context window on every turn (a block about the user, one about the agent itself), and they edit those blocks with memory tools, while older material goes to archival storage the agent searches when needed. The agent manages its own context, the way an operating system manages memory.
The framework is Apache 2.0. The pricing page now speaks to Letta's hosted product: Free allows 3 stateful agents with no model usage included (bring your own API keys or buy credits), Pro is $20 a month with $20 of credits and 20 stateful agents, and Teams Pro is $20 per seat per month. Cloud sandboxes are billed by running time, from $0.24 an hour for the regular size. To start Letta agents from other apps, see the Letta integration for Zapier.
Two limits matter. Memory blocks are always in the prompt, so every block you add is paid in input tokens on every request. And the product is moving: the Letta docs now state that the Docker image is no longer an actively maintained or supported product surface, and advise new work to use shared memory repositories rather than building on memory blocks. Adopting Letta means adopting its runtime, which suits a new agent better than an existing one.
- Agent edits its own memory blocks
- Archival memory for older context
- Apache 2.0 framework
- ✓Most control over what stays in context
- ✓Stateful agents that run for months
- ✓Hosted plans from $20/mo
- ✗You adopt a runtime, not a library
- ✗Blocks are paid in tokens on every turn
- ✗Docker image no longer actively maintained
The pick for a new, long-running agent that should curate its own context. Heavy for adding memory to an app you already ship.
LangMem
LangMem is LangChain's memory library. It gives an agent tools to record and search memories during a conversation (the hot path), a background memory manager that extracts, consolidates and updates knowledge after the fact, and utilities to refine the agent's own prompt from feedback. It is a library, not a service: there is no LangMem bill.
Its memory tools persist through LangGraph's BaseStore, and it plugs into the long-term memory store that LangGraph Platform deployments include by default. The examples use an in-memory store that loses everything on restart, so production means a database-backed store such as the Postgres one. The core API is written to work with other storage, but the documentation and examples are built around LangGraph.
The trade-off is work and latency. Memory formed in the hot path runs extra model calls while the user waits, so move extraction to the background manager for chat agents. You also own the quality: choosing what to store, deduplicating it and testing recall are your job. For our take on the wider framework, read our LangChain review.
- Hot-path tools and background manager
- Prompt optimization from feedback
- MIT license, no vendor bill
- ✓No new vendor if you run LangGraph
- ✓Full control of storage and models
- ✓Free to use
- ✗Built around LangGraph
- ✗Hot-path memory adds latency
- ✗You build dedup and evaluation yourself
The natural pick inside a LangGraph agent. Outside that ecosystem, a dedicated memory layer saves you work.
Seven rules that change your agent memory bill
Comparison guides list memory types. These are the units, plan rules and license details that decide what agent memory really costs and whether you can keep running it, read on each pricing page and in each set of docs.
The pitfalls
Zep: a credit is 350 bytes, not one message
Pitfall 1Zep bills 1 credit per episode up to 350 bytes, plus 1 credit for each extra 350 bytes or part of it. A 1,000-byte support message therefore costs 3 credits, and the Free plan's 10,000 monthly credits cover about 3,333 such messages, not 10,000. Reads, storage and users stay at 0 credits, so the fix is on the write side: send the turns that carry facts, and trim signatures and quoted replies before you add them.
Mem0: the free model calls end after 30 days
Pitfall 2On Mem0's Free plan, Mem0 pays the model calls during your first 30 days, with 10,000 adds and 1,000 retrievals a month. After that, the plan runs on your own LLM key, with higher limits (50,000 adds and 10,000 retrievals) but a model bill that now lands on your provider account. Plug in your key and set your provider's budget alert before the switch, not after the first invoice.
Mem0: reworded facts become new rows
Pitfall 3Users on the Mem0 repository explained in 2026 that the check that runs after extraction catches exact duplicates by hash; a fact phrased differently usually lands as a separate memory. Over months, a user can end up with three versions of the same preference. Schedule a review of what each user holds, or move to a plan with consolidation, before memories start contradicting each other in the prompt.
Letta: every memory block is paid on every turn
Pitfall 4Letta's memory blocks are always visible in the context window, with no retrieval step. That is what makes the agent consistent, and it is also an input-token cost on every single request. A 5,000-character block sent on each of 100,000 requests is half a billion characters of prompt. Keep core blocks short and push the rest to archival memory, which the agent searches only when it needs it.
Supermemory: open source repo, closed memory engine
Pitfall 5Supermemory's main repository, MCP server and plugins are MIT, and its SDKs Apache 2.0, which is why some guides call it open source. The memory engine itself is not open source. What you can run yourself is supermemory local, a free binary capped at 10,000 stored documents; running it in your own cloud starts on the Scale plan at $399 a month.
AWS AgentCore Memory: a short event is billed as 12 KB
Pitfall 6If you build on AWS, AgentCore Memory bills short-term memory by the gigabyte, and each event is billed at a minimum of 12 KB and a maximum of 64 KB. A 200-byte chat turn is counted as 12 KB, sixty times its size. Batch small turns into one event where the API allows it, and price long-term records separately: $0.75 per 1,000 records a month with built-in strategies.
Letta: the Docker image is no longer maintained
Pitfall 7Many tutorials still start Letta with its Docker image and a Postgres database with pgvector. The Letta docs now say that the Docker image is no longer an actively maintained or supported product surface, and point self-hosters to the local mode of the Letta app or CLI. If you need a self-hosted memory server you can keep in production, compare it with Mem0, Cognee or Hindsight, whose servers are part of their supported products.
Five agent memory setups, step by step
The right tool depends less on the benchmark than on what your agent must remember and for how long. These five setups cover most production agents we see.
The setups
A support agent that remembers each customer
Setup 1Store one memory space per customer, keyed by account ID, and write only resolved facts: plan, product versions, open issues, preferred channel. A temporal graph such as Zep fits here because a plan or an owner changes, and the agent must answer with the current value. Keep the ticket history in your helpdesk, and let memory hold the summary. For the agent itself, see our AI customer service agent guide.
A personal assistant that learns preferences
Setup 2Write preferences and decisions, not every sentence: "prefers morning meetings", "vegetarian", "reports to Ana". Mem0 or Supermemory handle this with user-scoped memory in a few calls. Retrieve the top five to ten memories before each answer, and give the user a way to see and delete what the assistant keeps, which also answers most privacy requests.
A coding agent that keeps project context
Setup 3Coding agents forget the conventions of a repository between sessions. A memory server with an MCP connector, such as Cognee, Supermemory or Hindsight, lets the agent store decisions ("we use pnpm", "tests live next to the code") and recall them in the next session. For Claude-based setups, our page on the MCP memory server for Claude shows the simplest version.
A no-code agent in n8n
Setup 4In n8n, the agent node takes a memory sub-node: start with chat memory in Postgres or Redis for the conversation window, and add a long-term layer only when users come back across days. Our guides to Postgres chat memory in n8n and Redis chat memory in n8n cover the short-term part.
Several agents sharing one memory
Setup 5When a research agent and a writing agent share memory, define who may write which facts. Letta's shared blocks illustrate the risk: a rethink is last-writer-wins, and a replace fails if the text changed in between, while an append-only insert stays safe. Give each agent its own scope and a shared, read-mostly scope for facts both rely on.
Pick your memory layer for the agent you ship
A language model only knows what is inside its context window for the current request. Agent memory adds what the window cannot hold: it decides what to keep from a conversation or a document, stores it outside the prompt, merges or retires it when a newer fact arrives, and retrieves the relevant pieces before the next answer. A vector database stores and searches embeddings; a memory layer adds the decisions on top (what becomes a memory, how it is updated, what is forgotten). If you only need to search documents, our vector database ranking is the better starting point.
Know the five kinds of memory the guides talk about. Short-term memory is the current conversation. Long-term memory survives across sessions. Semantic memory holds facts ("the customer is on the Pro plan"), episodic memory holds events ("the export failed on Tuesday's call"), and procedural memory holds how to do things ("refunds go to a manager first"). Then learn the unit each vendor bills: an add (Mem0) is one call that sends messages to be turned into memories, a credit (Zep) is 350 bytes written, a token (Supermemory, Cognee, Hindsight) is a slice of text ingested or recalled, a stateful agent (Letta) is one agent that keeps its memory.
Then ask each vendor for three things: how a contradicting fact is handled, how you export all memories for one user (and delete them on request), and what happens to your data if you leave the hosted plan.
You are a solo developer or a small team
Start with Mem0's free plan, or LangMem if your agent already runs on LangGraph. Both take an afternoon. Log what gets stored during the first week and read it.
Your agent serves customers in production
Look at how facts are updated before you look at speed: Zep invalidates old facts, Mem0 needs a hygiene routine. Estimate the bill on your real message sizes, since Zep counts bytes and Supermemory counts tokens.
You must keep data on your own servers
Mem0 (Apache 2.0), Cognee (Apache 2.0) and Hindsight (MIT) self-host with their full engine. Zep's engine Graphiti self-hosts with a graph database; the full Zep service goes into your VPC only on Enterprise.
You are building a new autonomous agent
Letta gives the agent control over its own memory blocks, and suits agents that run for weeks. If you prefer to keep your own framework, see our ranking of agentic AI frameworks first.
- Memory scopes: per user, per session, per agent
- A documented rule for contradicting facts
- Export and delete for one user, for privacy requests
- Self-hosting option and its license, read in the repository
- The billing unit, priced on your real message sizes
- A way to evaluate recall across several sessions
Your agent, your memory layer
Start from what your agent must remember and where your data may live, not from a leaderboard. To pick the agent platform itself, see our AI agent platforms ranking; to build one without code, our guide on how to build an AI agent.
Free plan, Apache 2.0 engine
Your facts change and history mattersZepTemporal graph, reads at 0 credits
Memory must also read files and mailboxesSupermemoryConnectors, Pro $19/mo
You need graph memory on your own serversCogneeApache 2.0, MCP server
You want no monthly feeHindsightPay per operation, MIT server
The agent should manage its own contextLettaSelf-edited memory blocks
Your agent runs on LangGraphLangMemMIT library, your own store
AI agent memory: your questions, our answers
Why do AI agents forget things between sessions?
Because the model itself keeps nothing between requests: each call only sees the text you send in its context window. Chat apps look like they remember because they resend the conversation, and that stops working once the history is too long or a new session starts. A memory layer stores the useful facts outside the prompt and brings back only the relevant ones, which also keeps your input-token bill flat as the history grows.
Do I need a memory tool, or can I manage context myself?
For short, single-session tasks, you can manage it yourself. Resending the conversation or a running summary works until sessions span days, facts change, or several agents share history. Before buying anything, check what your model provider already ships: Anthropic's memory tool, for example, lets Claude create, read, update and delete files under a /memories directory that your own application stores, and it pairs with context editing; you still decide what gets written, how it is organized and when it expires.
Does the OpenAI Agents SDK have built-in memory?
Yes, for the conversation, not for long-term facts. The Agents SDK provides built-in session memory: before each run, the runner retrieves the session's conversation history and prepends it to the input, and after each run it stores the new items, tool calls included. Sessions can be kept in SQLite, Redis, SQLAlchemy, MongoDB or Dapr. That replays a transcript; it does not extract, merge or retire facts, so add a memory layer once users come back across days.
What is context engineering, and where does memory fit in?
Context engineering is choosing what goes into the model's context window on each call: instructions, recent turns, tool results and retrieved memories. Memory is the part that survives the session; context engineering decides how much of it to load. Anthropic's docs show the split well: context editing clears specific tool results or thinking blocks on the server before the prompt reaches Claude, compaction replaces the older turns with a summary that Claude writes on the server, and the memory tool keeps in files what must outlive both. Budget your context first, then decide what memory may add to it.
How do I test whether memory improved my agent?
Test across sessions, never in one. Write cases where the agent must recall a preference or decision from an earlier session, run them with and without the memory layer, and compare task completion, wrong recalls and latency. Add one case where a fact changed, because stale memories are the most common failure, and keep the benchmark numbers vendors publish as a starting point only.
How do I handle privacy requests on agent memory?
Treat memories as personal data from day one. Scope every memory to a user ID, so you can export or delete one user's memories in a single call, and avoid writing raw identifiers you do not need. If data must stay in your infrastructure, self-host an Apache 2.0 or MIT engine such as Mem0, Cognee or Hindsight, or use Zep's Enterprise deployment inside your own VPC.
Is RAG the same as agent memory?
No. Retrieval-augmented generation fetches passages from a fixed set of documents, while agent memory is written by the agent's own interactions and changes over time. Most memory layers use retrieval underneath, and some, like Supermemory and Cognee, do both. If your agent only answers from a document base, a RAG pipeline on a vector database is enough; once it must learn about each user, add memory.
Get the next use-case guide in your inbox
One job, the tools that do it, and what they really cost.