---
title: "Agent Memory vs. Memory Middleware | Why Surreal | SurrealDB"
description: "How Agent Memory compares to Mem0, Zep, Letta, and other memory middleware. The fragmented memory tax and why memory should live in the database."
url: https://surrealdb.com/why/vs-memory-middleware
---

# Agent Memory vs. memory middleware

Mem0, Zep, Letta, and other memory middleware add another layer between your agent and storage. The fragmented memory tax is why memory should live in the database.

[Explore Agent Memory](https://surrealdb.com/agent-memory) [Join the early access](https://surrealdb.com/agent-memory/get-started)

1. ![Babcock](https://surrealdb.com/assets/static/babcock.lo4rnVg1.svg)
2. ![ING](https://surrealdb.com/assets/static/ing.X3I6S3_V.svg)
3. ![British Airways](https://surrealdb.com/assets/static/british-airways.KEsZiwV-.svg)
4. ![Nvidia](https://surrealdb.com/assets/static/nvidia.DaIEuMil.svg)
5. ![Apple](https://surrealdb.com/assets/static/apple.D5pq4flY.svg)
6. ![SpaceX](https://surrealdb.com/assets/static/spacex.CQJEk-IL.svg)
7. ![Samsung](https://surrealdb.com/assets/static/samsung.CH-vQgnb.svg)
8. ![adidas](https://surrealdb.com/assets/static/adidas.DdTC5qhk.svg)
9. ![Tencent](https://surrealdb.com/assets/static/tencent.paQmLxyy.svg)
10. ![Alibaba](https://surrealdb.com/assets/static/alibaba.B16idgfM.svg)
11. ![PolyAI](https://surrealdb.com/assets/static/poly-ai.c3w_fAg6.svg)
12. ![Later](https://surrealdb.com/assets/static/later.Ds736jFO.svg)
13. ![Verizon](https://surrealdb.com/assets/static/verizon.BI7CajdX.svg)
14. ![Liberty Mutual](https://surrealdb.com/assets/static/liberty-mutual.B7qOU1pd.svg)
15. ![Walmart](https://surrealdb.com/assets/static/walmart.BjDg_Sr8.svg)
16. ![Carrier](https://surrealdb.com/assets/static/carrier.D21gC6NX.svg)
17. ![Saks Fifth Avenue](https://surrealdb.com/assets/static/saks-fifth-avenue.COIDpLSb.svg)
18. ![San Francisco Compute Company](https://surrealdb.com/assets/static/sfcc.B7jlImq4.svg)
19. ![Shield AI](https://surrealdb.com/assets/static/shield-ai.pINZ0KJr.svg)
20. ![Wix](https://surrealdb.com/assets/static/wix.DvHhmoBi.svg)

THE LANDSCAPE

## A growing category with a shared limitation

A growing number of agent memory middleware products have emerged. Each solves a real developer pain point, but they all share the same architectural limitation: memory lives outside the database, not inside it.

### Mem0

LLM-driven memory extraction and consolidation with optional graph storage. Excellent developer experience, but built on fragmented infrastructure underneath.

### Zep

Long-term memory for assistants with temporal knowledge graphs and entity extraction. Adds structure, but as a separate service with its own consistency model.

### Letta (MemGPT)

Self-editing memory framework where agents manage their own context window and long-term storage. Innovative, but memory lives outside the transactional boundary.

THE FRAGMENTED MEMORY TAX

## Middleware hides the problem. It doesn't solve it.

Memory middleware sits between the agent and the database, introducing consistency gaps, added latency, separate permissions, and operational burden.

App state

User session

Vector DB

Embeddings

Graph DB

Relations

Doc store

Documents

Auth

Identity

Data fragments at every system boundary

Agent

Vector DB

Graph DB

Doc store

Auth

Total

Cumulative latency

### Consistency gaps

Writes to memory and writes to state can diverge - no atomicity across systems.

### Latency

Every memory operation is a round trip through middleware. Two hops instead of one.

### Operational burden

Another service to deploy, monitor, and secure. Another failure mode to manage.

### Separate permissions

Memory middleware has its own auth. Your database has its own. Two permission models to keep in sync.

THE ALTERNATIVE

## ACID transactions across every data model

Agent Memory eliminates the middleware layer entirely. Memory lives in SurrealDB with ACID guarantees, unified permissions, and zero extra infrastructure.

### ACID memory

Agent Memory lives in SurrealDB. Agent Memory and application state commit in one transaction - no divergence.

### One permission model

RBAC and record-level permissions apply to memory and data alike. One auth, one policy.

### No middleware

Agents write directly to the database. One round trip. No extra latency, no extra failure modes.

TRUSTED BY

## Enterprise teams building on SurrealDB

From knowledge graphs to AI assistants - how enterprise teams are building on SurrealDB.

![Samsung](https://surrealdb.com/assets/static/4c58b81e7b3c9466.C_Hv0eml.svg) DATABASE

### [Unlocking insights with knowledge graphs](https://surrealdb.com/customer/samsung)

Samsung Ads uses SurrealDB to build dynamic, real-time knowledge graphs for smarter campaign execution - collapsing three legacy data stores into one.

Read case study

![Verizon](https://surrealdb.com/assets/static/18b99996c689000f.B5PQ-nI9.svg) DATABASE

### [AI assistant empowering 10,000 technicians](https://surrealdb.com/customer/verizon)

Verizon uses SurrealDB to power a generative AI assistant for 10,000 field technicians, delivering instant access to documentation, outage updates, and workflows.

Read case study

![Tencent](https://surrealdb.com/assets/static/401d8346058682c8.DqM87mst.svg) DATABASE

### [Unified infrastructure monitoring](https://surrealdb.com/customer/tencent)

Tencent consolidated nine backend tools into one real-time monitoring platform powered by SurrealDB's multi-model context graph.

Read case study

![PolyAI](https://surrealdb.com/assets/static/c5fa07c66cd05131.BnC7wHcc.svg) DATABASE

### [High-performance customer service AI powered by RAG](https://surrealdb.com/customer/polyai)

PolyAI connects SurrealDB to Agent Studio for low-latency, customer-controlled RAG across voice AI experiences.

Read case study

![Saks Fifth Avenue](https://surrealdb.com/assets/static/saks-fifth-avenue-white.pDJ9HGmf.svg) DATABASE

### [AI-powered personalisation at massive scale](https://surrealdb.com/customer/saks)

Saks Fifth Avenue uses SurrealDB's vector search and graph capabilities to deliver real-time, AI-powered personalisation across 5 million luxury customers and 45 million monthly product-recommendation queries.

Read case study

FREQUENTLY ASKED QUESTIONS

## Memory middleware

How does Agent Memory differ from Mem0 or Zep?

Can I use LangChain or CrewAI with SurrealDB instead of their built-in memory?

Does eliminating middleware actually reduce latency?

GET STARTED

## Memory without the memory tax

Agent Memory eliminates the fragmented memory tax entirely. No middleware, no consistency gaps, no extra infrastructure.

![Samsung](https://surrealdb.com/assets/static/4c58b81e7b3c9466.C_Hv0eml.svg)![NVIDIA](https://surrealdb.com/assets/static/nvidia.DaIEuMil.svg)![Apple](https://surrealdb.com/assets/static/f7dc2519e0d212bc.Cn8MYAK7.svg)![Verizon](https://surrealdb.com/assets/static/18b99996c689000f.B5PQ-nI9.svg)![Tencent](https://surrealdb.com/assets/static/401d8346058682c8.DqM87mst.svg)

SOC 2 Type 2

GDPR

Cyber Essentials Plus

ISO 27001

[Explore Agent Memory](https://surrealdb.com/agent-memory) [Join the early access](https://surrealdb.com/agent-memory/get-started)

```json
{"@context":"https://schema.org","@type":"Organization","name":"SurrealDB","url":"https://surrealdb.com","logo":"https://surrealdb.com/assets/static/logo.BG7_TG2b.svg","description":"SurrealDB is the unified data layer for AI. A multi-model database for documents, graphs, vectors, and time-series.","foundingDate":"2022","hasCertification":[{"@type":"Certification","name":"SOC 2 Type 2"},{"@type":"Certification","name":"GDPR"},{"@type":"Certification","name":"Cyber Essentials Plus"},{"@type":"Certification","name":"ISO 27001"}],"owns":[{"@type":"SoftwareApplication","name":"SurrealDB","url":"https://surrealdb.com/surrealdb"},{"@type":"SoftwareApplication","name":"Agent Memory","url":"https://surrealdb.com/agent-memory"}],"knowsAbout":["multi-model databases","document databases","graph databases","vector search","time-series databases","SurrealQL","Agent Memory","real-time databases","embedded databases","context layer","graph ontology","distributed database","knowledge graphs","distributed transaction protocols","highly-scalable databases"],"sameAs":["https://www.wikidata.org/wiki/Q124316308","https://github.com/surrealdb/surrealdb","https://twitter.com/surrealdb","https://www.youtube.com/@surrealdb","https://www.linkedin.com/company/surrealdb","https://discord.gg/surrealdb","https://www.reddit.com/r/surrealdb","https://www.instagram.com/surrealdb","https://medium.com/surrealdb","https://dev.to/surrealdb"]}
```

```json
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://surrealdb.com"},{"@type":"ListItem","position":2,"name":"Vs memory middleware","item":"https://surrealdb.com/why/vs-memory-middleware"}]}
```

```json
{"@context":"https://schema.org","@type":"FAQPage","mainEntity":[{"@type":"Question","name":"How does Agent Memory differ from Mem0 or Zep?","acceptedAnswer":{"@type":"Answer","text":"Mem0 and Zep are middleware layers that sit between your agent and storage, abstracting over a vector store, a document store and a graph engine that remain separate systems. Agent Memory is built on SurrealDB, so memory and application data live in one transactional store - no second database to keep in step, and no cross-database consistency gap."}},{"@type":"Question","name":"Can I use LangChain or CrewAI with SurrealDB instead of their built-in memory?","acceptedAnswer":{"@type":"Answer","text":"Yes. SurrealDB integrates with LangChain, LlamaIndex, and any MCP-compatible client. You can replace framework memory modules with Agent Memory for persistent, transactionally consistent memory without changing your orchestration logic."}},{"@type":"Question","name":"Does eliminating middleware actually reduce latency?","acceptedAnswer":{"@type":"Answer","text":"Yes. Memory middleware adds a network hop for every memory operation. With Agent Memory, memory reads and writes happen inside the database - one round trip instead of two. This compounds under load and across multi-agent workflows."}}]}
```
