What is a memory layer for AI agents?
A memory layer is the part of an agent stack that keeps information between sessions, so an agent can use what it saw yesterday without the whole history in its prompt. It sits beside the model and the orchestration code, and it decides what gets stored, how it is found again, and who can read it.
A language model forgets everything when a conversation ends. The memory layer extracts something worth keeping (a user preference, a fact about an account, a lesson from a failed task), stores it, and returns the relevant pieces when the next question arrives.
The tools differ in what counts as a memory: extracted user facts, a graph of entities, a key-value record or a written rule. They also differ in who decides what gets in (the model, your code, the agent or an approver) and where they run (a managed cloud, your VPC or a library in your service).
Retrieval-augmented generation (RAG) searches a fixed set of documents when a question arrives. A memory layer also writes: it stores what the agent learned and updates it between sessions. Many layers sit on a vector store, a graph or both, which knowledge graph vs vector database compares.
What should an AI agent memory layer remember?
It should remember whatever the agent would otherwise get wrong on the next run: user preferences for an assistant, changing facts for an account agent, and approved rules for an agent that acts on company policy. Each of those fails in a different way.
User and conversation memory is what mem0 handles. By default it “stores extracted memories, not a verbatim transcript”, scoped by user, agent, run and metadata docs.mem0.ai. A support bot that remembers a customer prefers email over phone is using this kind of memory.
For facts that change over time, Graphiti uses validity windows. Its README says that when information changes, “old facts are invalidated” rather than deleted, so you can query what was true at any earlier point github.com/getzep. Zep uses the same temporal model in its managed Context Graphs.
LangMem splits memory into semantic, episodic and procedural: facts that ground responses, past interactions kept as examples, and instructions about how the agent should behave, which “evolves through feedback and experience” langchain-ai.github.io.
Business rules are memory too. An accounts payable agent needs to know that a vendor exception expired last month, which approval threshold applies, and which version of the policy was live when an invoice was paid. A wrong entry here costs money. For one process worked through, see AP 3-way match automation from an SOP.
How do nine memory layers compare side by side?
They split into managed memory services, open-source frameworks you run yourself, and one governed rules layer.
| Tool | Who it is for | Memory it provides | Where it is strong | What to check |
|---|---|---|---|---|
| Trail | Enterprise teams whose agents act on company policy and SOPs | Approved business rules parsed from docs, Notion, Slack and SOPs, each cited to document, page and line | A named approver and timestamp on every rule; prior versions retained; agents connect over MCP, REST and GraphQL; managed, single-tenant or VPC | A governed rules layer, not a per-user chat memory SDK. Free plan, paid plans priced per year, single-tenant from the Medium plan and in-VPC on Large; trailhq.com/docs is still a placeholder, so we found no public developer docstrailhq.com |
| mem0 | Developers adding user memory to assistants and support bots | Extracted memories scoped by user, agent and run | Library, self-hosted server or managed cloud; Apache-2.0; MCP, LangGraph and CrewAI integrations | The open-source version has no graph memory; homepage states SOC 2 Type 1docs.mem0.ai |
| Zep | Enterprises unifying business data, documents and conversations for agents | Temporal Context Graphs with bi-temporal facts | RBAC, ABAC policies, source traceability and audit logs; SOC 2 Type II; cloud, own keys or VPC | Docs say memory admission stays your application's responsibility; Community Edition is deprecatedhelp.getzep.com |
| Graphiti | Teams that want to build and run their own temporal graph | Temporal context graph with provenance to source episodes | Apache-2.0; facts with validity windows; Neo4j, FalkorDB or Amazon Neptune; reference MCP server, not for production | Governance and compliance are listed as self-managedhelp.getzep.com |
| Cognee | Builders wanting open-source graph plus vector memory they can self-host | Knowledge graph, vector search and session memory | Apache-2.0; dataset permissions, tenants and roles; self-hosted, Cognee Cloud or BYOC | Enterprise page says SOC 2 is in progresscognee.ai |
| LangGraph | Developers orchestrating agents in code | Checkpointers for thread state, stores for long-term key-value data | MIT; time travel over thread history; Postgres, MongoDB and Redis stores | Docs call long-term memory a complex challenge without a one-size-fits-all solution; writing memories is your codedocs.langchain.com |
| LangMem | LangGraph users who want extraction and prompt refinement | Semantic, episodic and procedural memory | MIT; hot-path tools plus a background memory manager | Latest PyPI release is 0.0.30, uploaded 27 October 2025pypi.org |
| Letta | Builders of stateful, self-improving agents, from coding agents to always-on agents | Self-edited agent memory in a git-backed MemFS | Apache-2.0; every change tracked in git; local runtime or Letta Cloud | The agent commits lessons itself; people review after the factdocs.letta.com |
| Supermemory | Users of coding assistants and builders wanting memory plus RAG in one API | Extracted facts, user profiles and knowledge base retrieval | Review queue for inferred memories; versioned updates; SOC 2 Type II; plugins and MCP | Self-hosted server source is not in the public MIT repositorysupermemory.ai |
Facts in this table were checked against the sources listed at the end of this page, between and .
Which memory tools are built for enterprise agents?
Zep, Cognee, Supermemory and Trail each describe enterprise access control on their own pages, while the open-source frameworks leave governance to you. By “enterprise” we mean role-based access, audit logs, a compliance report and a deployment that keeps data inside your boundary.
Zep calls itself “the unified context layer for enterprise data” and runs as Zep Cloud, Zep Cloud with your own encryption keys, or inside your VPC getzep.com. Its governance docs cover role-based access for dashboard users, attribute-based (ABAC) policies for agent API keys, source traceability, audit logging and API logging help.getzep.com. Its security page states “SOC 2 Type II Certified” and also draws a line: “Your application remains responsible for prompt construction, memory admission, tool permissions, and action authorization” help.getzep.com.
Cognee is open source under Apache-2.0 and documents “per-dataset storage, dataset-level permissions, and tenants and roles for enterprise access control” docs.cognee.ai. It can run self-hosted, on Cognee Cloud, or BYOC in your own cloud, and its README describes importing memory from mem0, Letta, Zep and Graphiti github.com/topoteretes. Its enterprise page states: “SOC 2 is in progress” cognee.ai.
Supermemory describes itself as “Memory and continual learning for agents”. Its Enterprise tier has member roles and scoped API keys, and its security docs list SOC 2 Type II supermemory.ai. The local self-hosted binary is free within a lite license, but the docs note “Its server source is not in the public repository” supermemory.ai, so the MIT license on GitHub does not cover the server you would run.
mem0 also pitches to enterprise teams, with audit logging of every read and write and deployment on Kubernetes, private cloud or air-gapped. Its homepage states SOC 2 Type 1 and HIPAA and GDPR compliance mem0.ai. If your security team requires a Type II report, ask mem0 directly.
How do citations and approvals change agent memory?
Citations let a reviewer check where a memory came from, and approvals decide whether it should be there at all. Without both, an agent can act on a wrong memory and nobody can trace why.
Graphiti says “Every entity and relationship traces back to the episodes (raw data) that produced it” github.com/getzep. Zep’s source traceability keeps facts tied to the episodes they came from, and Supermemory’s history endpoint returns update history with source documents supermemory.ai. Zep’s docs add that source traceability “does not establish that the source content or a derived fact is true” help.getzep.com.
Approval is rarer. Supermemory flags memories that nobody stated directly as inferred and offers endpoints to “approve, decline or undo a decision on each one” supermemory.ai. Inferred memories stay searchable while they wait for review; declining one removes it from search. Zep has a human review option for Agent Skills, though the default is auto, which admits each new Skill version “without human review” help.getzep.com. In mem0, Graphiti, LangGraph and LangMem we found no mention of a built-in approval step before a memory is stored (LangGraph’s human-in-the-loop interrupts could be wired to one in your own code).
Letta lets the agent write its own memory. Letta Code’s README says its agents “learn and evolve over long horizons through rewriting their own memory” github.com/letta-ai, and the docs say “The agent decides where the lesson belongs and commits the update to MemFS” docs.letta.com. MemFS is a git repository docs.letta.com, so every change is versioned and a person can inspect it afterwards. That suits a coding assistant; for an agent approving payments, review after the fact may come too late.
When is a developer memory framework enough?
A framework is enough when one team owns the agent, the memories are about users or tasks rather than company policy, and you are comfortable operating the storage.
LangGraph fits if you already orchestrate agents with it. Its persistence layer “gives agents short-term memory through checkpointers and long-term memory through stores” docs.langchain.com, and checkpointers allow “time travel” to replay earlier steps docs.langchain.com. Deciding what to write is left to your code; the memory docs say “Long-term memory is a complex challenge without a one-size-fits-all solution” docs.langchain.com.
LangMem fills part of that gap with hot-path memory tools and a background manager that “automatically extracts, consolidates, and updates agent knowledge”. Its README also warns that the in-memory store used in the quickstart loses memories on restart github.com/langchain-ai.
mem0’s open-source library adds user memory to an existing app, and its README sums up the options: “Just testing? Use the library. Building for a team? Self-hosted. Want zero ops? Cloud.” The open-source retrieval “has no graph memory” docs.mem0.ai, and mem0 says its benchmark scores reflect the managed platform, which “includes proprietary optimizations not available in the open-source SDK” github.com/mem0ai.
Graphiti suits teams that want temporal facts and provenance without a vendor. Its README says: “Choose Graphiti if you want a flexible OSS core and you’re comfortable building/operating the surrounding system” github.com/getzep. Its MCP and REST servers are reference implementations that “are not production deployments” and have no authentication github.com/getzep.
Memory for coding agents is its own case: see our page on coding-agent memory, which covers Trail-code.
What does a governed rules layer like Trail add?
It puts an approval step and a version history on the memory itself: agents read only rules a person signed off, and every answer cites the line it came from. That is the job Trail, the memory and context layer for enterprise AI agents, is built for.
Trail parses a company’s documents, Notion pages, Slack threads and SOPs into a graph of business rules trailhq.com. On its Rule Engine page each rule is “a governed object” with five properties: Provenance, Scope, Approval (“A named approver, with a timestamp”), Version (“Prior versions retained, so past decisions replay”) and Access (“Role-scoped, for people and for agents alike”). Agents cannot create or change rules: “Agents read approved rules. Proposing comes from Trail, deciding comes from your team, and an unreviewed proposal is not reachable by any agent” trailhq.com.
Each answer comes back with a citation to document, page and line plus a confidence score, and the team sets the threshold below which an agent must stop and ask. When a reviewer corrects a run, the correction becomes a proposed change that someone approves; the Context Graph How it works page says of the agent: “It can report. It cannot approve.” An approved rule that loses a conflict is versioned, not deleted, so a decision from last quarter replays against what was live then trailhq.com.
Agents connect over a native MCP server, LangChain and LlamaIndex retrievers, or REST and GraphQL, and the homepage lists Claude, ChatGPT, Copilot, Bedrock, Vertex AI, SAP Joule and Agentforce. It runs managed, single-tenant or in your own VPC, and the homepage shows SOC 2 Type II, ISO 27001, GDPR and HIPAA badges trailhq.com. Single-tenant starts on the Medium plan and in-VPC on Large. There is a free plan, and paid plans cost $20k, $60k or $150k per year trailhq.com.
Trail is not a drop-in SDK for per-user chat memory, and its own blog lists memory SDKs such as mem0, Zep and Letta as the “assemble” route for teams building that themselves trailhq.com. The docs page is a placeholder at the time of writing trailhq.com, so developers evaluating the API will need a demo rather than a reference.
How should you choose a memory layer for long-term agent use?
Start from what a wrong memory would cost, then pick the lightest layer that controls that risk. A forgotten preference costs a reply; a stale policy exception costs an audit finding.
Be careful with benchmark claims. mem0, Zep and Supermemory publish LoCoMo or LongMemEval results, and Trail’s own research page argues these “measure retrieval recall, which is only one part of the actual deployment problem” trailhq.com. A recall score tells you little about whether an agent applied the right threshold on the right date, so run a pilot on your own cases.
What to check before choosing a memory layer
Checklist- ProvenanceCan every memory or rule be traced to the message, episode or document line it came from?
- Approval before agents readDoes a person sign off before a new memory reaches agents, or only review after the fact?
- VersioningAre old values kept with dates, so a past decision can be replayed against what was live then?
- Access controlCan you scope reads by role, team, tenant or agent, and is every read logged?
- DeploymentManaged cloud, your VPC, single-tenant or self-hosted, and is the server code you would run actually open?
- Long-term memory modelExtracted facts, temporal graph, key-value store, self-edited files or approved rules: which matches what the agent must remember?
- Compliance evidenceIs the SOC 2 report Type I, Type II or in progress, and does it cover the deployment you plan to use?
- Benchmark scopeDo published scores cover the edition you will run, and do they test rule-following or only recall?
Settle the memory model first, then governance, then deployment. Swapping a memory layer later means migrating what it stored. Cognee documents an import path from mem0, Letta, Zep and Graphiti; for any other tool, ask how you would export.
How we compared these nine memory layers
We read each tool’s homepage, documentation and GitHub README, its license on GitHub, PyPI release data for LangMem, and Trail’s pricing page. We checked sources on 16 October 2026 and pricing pages again on 21 October. The table columns are the criteria. Across the body we also compared provenance, approval before agents read, versioning, access control, deployment options and stated compliance. We did not install, deploy or benchmark any of these tools, so nothing on this page reports hands-on results. Trail publishes this page and is one of the nine options compared.
Frequently asked questions
Best memory layer for AI agents?
For a support bot or assistant that should remember each user, mem0 or Zep is the usual starting point; for a team that wants to run its own graph, Graphiti or Cognee; for agents built on LangGraph, its own stores plus LangMem. Agents that must apply company policy need a layer where a person approves what agents read.
best agent memory system?
Pick by the kind of memory the agent needs. Facts about a user fit mem0 or Supermemory, facts that change over time fit the temporal graphs in Zep and Graphiti, and an agent that rewrites its own memory and skills fits Letta. Rules that govern business decisions are a separate kind of memory and need provenance and approval.
best memory system for AI agents?
Pick by where it has to run. Graphiti, Cognee and the mem0 library are open source and self-hostable, Zep runs as a cloud service or in your VPC, and Letta runs locally or on Letta Cloud. Check compliance status on each vendor's own pages: Zep states SOC 2 Type II, mem0 states SOC 2 Type 1, and Cognee says SOC 2 is in progress.
which AI agent memory framework supports long term memory?
LangGraph, LangMem, Letta, mem0, Zep, Graphiti, Cognee and Supermemory all document memory that persists across sessions. LangGraph splits it into checkpointers for one thread and stores for long-term data, LangMem adds semantic, episodic and procedural memory on top, and Letta keeps long-term memory in a git repository per agent.
Memory layer for enterprise AI agents?
Enterprise agents need memory with access control, an audit trail and a clear source for every fact. Zep offers RBAC, ABAC policies and source traceability, Cognee offers tenants and roles, and Trail serves agents only rules a named person has approved, cited to document, page and line. Deployment matters too: check for VPC or single-tenant options.
Is Zep open source?
Zep's own docs say Zep Community Edition, which allowed local hosting, is deprecated and no longer supported. The open-source part is Graphiti, the context graph framework that powers Zep Cloud, under Apache-2.0. Zep itself runs as a managed cloud or as a deployment in your VPC.
Can an agent write its own long-term memory without review?
In several tools, yes. Letta's docs say the agent decides where a lesson belongs and commits it to memory, with people reviewing afterwards, and Zep admits new Agent Skill versions without human review by default. Supermemory offers a review queue for inferred memories, so check which writes need sign-off.
Do memory benchmarks tell you which layer to pick?
Only in part. LoCoMo, LongMemEval and BEAM measure whether stored information is recalled, and mem0 notes that its published scores reflect its managed platform rather than the open-source SDK. Test on your own tasks, including whether the agent applies the right rule, not only whether it recalls a fact.
What does a memory layer for AI agents cost?
The open-source libraries are free to license, so you pay for the servers and model calls behind them. Hosted plans checked on 21 October 2026: mem0 is free, then $19 or $249 a month; Zep starts free with 10,000 credits, then $125 a month; Supermemory runs from free to $399 a month. mem0 and Zep price Enterprise plans separately.
Sources checked
Show 47 sources
- Trail homepage
- Trail Rule Engine
- Trail Context Graph: how it works
- Trail comparison: RAG finds passages
- Trail pricing
- Trail docs placeholder
- Trail blog: what is a company brain
- Trail research: TRACE
- mem0 homepage
- mem0 docs: how Mem0 works
- mem0 README
- Zep homepage
- Zep docs: governance
- Zep docs: security and compliance
- Zep docs: source traceability
- Trail llms.txt
- LangGraph product page
- Letta homepage
- Supermemory docs: security
- Zep docs: FAQ
- Zep docs: Agent Skills learning and admission
- Graphiti README
- Zep docs: Zep vs Graphiti
- Cognee homepage
- Cognee docs index
- Cognee enterprise
- LangGraph docs: persistence
- LangGraph docs: memory
- LangMem conceptual guide
- LangMem README
- LangMem on PyPI
- Letta docs: MemFS
- Letta docs: memory
- Supermemory homepage
- Supermemory docs: memory review
- Supermemory docs: local vs enterprise
- Supermemory docs index
- LangGraph docs: checkpointers
- LangGraph stores
- getzep/graphiti on GitHub (Apache-2.0)
- topoteretes/cognee on GitHub (Apache-2.0)
- letta-ai/letta on GitHub (Apache-2.0)
- supermemoryai/supermemory on GitHub (MIT)
- Letta Code README
- mem0 pricing
- Zep pricing
- Supermemory pricing