How AI Agents Remember: 5 Memory Systems, Compared

Mem0, Zep, Letta, LangMem, and Cognee all promise agents that remember, and all five are wrong to compare on a single score. Mem0, Zep, Letta, LangMem, and Cognee do not sell the same memory. The choice comes down to three questions, not one score: what each system stores, who curates it, and how a wrong memory gets corrected or deleted, because the vendor tables disagree with each other on scores. Pick the memory type first, and the tool follows. Pick the score first, and the tool will remember the wrong things efficiently.

Editorial graphic: the headline How AI Agents Remember, on five memory systems and one decision that matters most

Why a big context window is not memory

A context window holds what the agent is looking at right now. Memory holds what it learned earlier and can bring back later, without paying to resend everything on every turn. Sending a full conversation history on every call is costly, since providers meter input on each call, and models use information buried in long prompts less reliably. Memory persists across sessions and loads back only the relevant pieces, keeping the active prompt small. That distinction is the whole market: if an agent only needs one session, it needs no memory tool at all. If it needs to stop asking the same user the same questions, to track a fact that changed, or to keep its own working notes across weeks, it needs a memory layer, and the layer's design decides what survives. The prediction machinery underneath is a separate question, covered in our visual explainer of how transformers work, which explains why a model predicts the next token from context rather than remembering a fact the way a database does.

Four kinds of memory, five tools

Agent memory is not one thing. The comparison below follows a published synthesis that sorts the field by what each system remembers, with every claim about how a tool works drawn from that vendor's own documentation as cited in the synthesis. Conversation and user memory stores what was said, summarized into durable facts about a user or session. Entity and relational memory stores facts as a graph of entities and relationships, so the agent can reason about how facts connect and when they stopped being true. Agent-managed context lets the agent itself curate its own memory, deciding what stays in view. Procedural memory stores learned rules about how the agent should behave, typically fed back into prompts. A fifth need, context grounded in a team's own database rather than in conversations, is a separate layer, not a memory tool, and none of the five systems below provides it fully.

SystemRemembersCore ideaTime handlingCorrection pathBest fit
Mem0Conversation and user factsExtracted facts scoped by user, agent, run, and appAdd-only ingestion; optional expiry date per memoryNew fact plus expiry, or a delete scoped to user, agent, app, or runPersonal assistants and support agents
ZepEntity and relational factsTemporal knowledge graphValidity intervals stored on fact edgesSingle call deletes a user's threads, artifacts, and graphAgents reasoning over facts that change
CogneeEntity and relational facts from own sourcesKnowledge graph plus vector indexEvent timeline; valid-to on nodes only, not filtered at searchForget operation; temporal mode keeps superseded factsGraphs built from documents, code, and database rows
LettaAgent-managed contextMemFS, a git-backed filesystem of memory files the agent editsAgent rewrites files; git keeps the historyFile edit; history stays in gitPersistent, long-lived agents with an evolving identity
LangMemSemantic, episodic, and procedural primitivesLangGraph BaseStore collectionsUp to the developer's implementationDeveloper-built consolidation updates entriesTeams already building on LangGraph
Bar chart of feature counts across the five memory systems: self-host path 5 of 5, hosted service 3 of 5, full temporal validity 1 of 5, agent curates 1 of 5, database native partial 1 of 5

The erasure test: ask it before you store anything real

The comparison table leaves out the dimension that catches teams late, so this article centers it. How does a memory get corrected or removed? Mem0 accumulates facts, so a correction is a new fact plus either an expiry date set at write time or an explicit delete scoped to a user, agent, app, or run, and teams must check which behavior their installed version has, since older Mem0 documentation still describes an extraction pass that updates and deletes facts. Zep deletes a user's threads, artifacts, and graph in a single call, which is how it answers a right-to-be-forgotten request, and its temporal graph preserves history by recording when a fact became invalid instead of overwriting it. Letta's memory is files in a git-backed repository, so a correction is a file edit and the history stays in git, which is an audit trail and also a retention decision. LangMem gives the developer primitives, so the correction path is whatever the developer builds, including background consolidation that updates entries. Cognee offers a forget operation, with a temporal mode that keeps superseded facts rather than erasing them. Any shortlist that cannot answer the erasure question in one sentence is not ready to store information about a real person, no matter how good its demo looks.

Why this comparison refuses to rank by benchmark score

Vendor comparison tables in this field are often written by the vendors being compared, and their benchmark numbers disagree. One synthesis notes that on one long-conversation benchmark, at about 26,000 tokens per conversation, sending the whole history beat every tool in a vendor's own table, while on a much longer-history benchmark a different vendor's paper reports the reverse, and what holds across both is that the tools win on cost. A slowest-system row for LangMem in one table was produced by Mem0 rather than by LangChain, so it must be measured on the buyer's own loop before ruling anything out. That is why this article ranks nothing by score and instead gives a decision rule: measure on your own history length, your own retrieval load, and your own correction cases, because a benchmark's history length, harness, and sponsor decide its winner more often than the memory design does. The chart above counts design features from the matrix, not benchmark wins, for the same reason: almost every system offers a self-host path, only one offers full temporal validity, and only one is curated by the agent itself. Those are design facts a buyer can verify. A disputed score is not.

Pick by bottleneck, not by brand

If the agent must remember user preferences and past conversations across sessions, and stop asking the same questions, Mem0's extracted-fact model fits, with Python and JavaScript SDKs and a hosted platform or self-hosted Apache 2.0 deployment. If facts about entities relate and change over time, a customer who changed plans, a preference that was superseded, an account that moved owners, Zep's temporal graph fits, hosted as Zep Cloud or self-hosted through its Apache 2.0 Graphiti engine, with Python, TypeScript, and Go SDKs, noting that the open-source engine requires bringing your own graph database and building conversation management and retrieval tuning yourself. If the graph must contain the contents of a team's own systems, not only the facts an agent heard, Cognee fits, as an Apache 2.0 self-hosted Python pipeline with a Model Context Protocol server, with one limit: its relational migration turns table rows into nodes and foreign keys into edges, so a schema that does not declare its foreign keys arrives unconnected, and its database grounding is partial, rows and keys copied in, not a live semantic layer over the database. If the agent is a persistent coworker whose identity evolves, Letta fits, self-hosted through its App Server or on Letta Cloud, with a TypeScript agent SDK and a Python API client, provided the team is comfortable giving the agent authority over its own context. If the team already builds on LangGraph, LangMem fits as MIT-licensed primitives inside the LangGraph process, Python only, with the caveat that it has shipped no release since October 2025 even as commits continue, and that it is building blocks, not a standalone product.

Three cautions close the decision. First, none of the five resolves what a team's database means; that is a context layer that composes with a memory tool, and buying a memory tool expecting database semantics will disappoint. Second, memory writes are also a security surface: whatever a runtime keeps in the prompt is paid for again on each later turn, and a payload designed to sit in memory can persist across sessions, so write policies and review matter as much as retrieval quality. Third, this comparison is a dated snapshot, October 29, 2026, built from vendor documentation as cited in a published synthesis and corroborating comparisons, not from hands-on testing by ByteHerald, and vendor documentation changes: check the correction behavior, the release status, and the self-host path of the installed version before committing, because the version in a comparison table is rarely the version that ships.

By ByteHerald Staff. Datapace comparison titled "LangMem vs Mem0 vs Zep vs Letta vs Cognee: how to choose," read in full on October 29, 2026, gave the five-system matrix, the Mem0 add-only ingestion with expiry-date and scoped-delete correction, the Zep temporal knowledge graph with validity intervals and single-call user deletion, the Graphiti Apache 2.0 self-host path, the Cognee Apache 2.0 pipeline with row-to-node migration and partial database grounding, the Letta MemFS git-backed filesystem, the LangMem Python-only BaseStore primitives with no release since October 2025, and the long-conversation benchmark note that whole-history sending beat every tool at about 26,000 tokens in one cited run. Corroborating comparisons, found by search on October 29, 2026, flagged the benchmark disputes used here: vendor LoCoMo scores described as disputed or self-reported, Zep Community Edition discontinued in April 2025, and Cognee forget behavior with temporal history kept.

BH
Written by