Skip to content

Agent Memory vs. memory middleware

Middleware. Mem0, Zep and Letta sit between the agent and its storage.
The cost. Separate stores add a service to run and a consistency gap.
Agent Memory. Memory on SurrealDB, with facts and their history written in one transaction.

THE LANDSCAPE

A category with one shared limit

Mem0

LLM-driven extraction and consolidation, with optional graph storage. Strong developer experience over a set of separate stores.

Zep

Long-term memory with temporal knowledge graphs and entity extraction. The structure arrives as a separate service with its own consistency model.

Letta (MemGPT)

A self-editing memory framework where the agent manages its own context window. Memory sits outside the transactional boundary.

THE COMPARISON

A layer between the agent and its data. What the middleware adds, and what Agent Memory keeps in the database.

Consistency

Agent Memory

Memory middleware

Atomicity
One transactionFacts, documents, graph relationships, vectors and their history are written in one transaction.
Two systemsMemory commits in the middleware, state in the database, separately.
Where state lives
In the databaseThe application tier is stateless: every fact, vector and trace lives in SurrealDB.
In the service's storesEvery memory operation goes through the service, then its own set of separate stores.
Operations
Stores to run
One databaseOne SurrealDB instance holds graph, vector, document, relational and geospatial state.
Several storesA vector store, a document store and a graph engine that stay separate, behind a memory service.
Permissions
Deny by defaultContexts isolate tenants and Scopes grant per verb, and a key can only narrow its grants.
Two modelsOne permission model for memory, another for the data it refers to.

THE ALTERNATIVE

Memory on the database

HOW IT WORKS

Recall and remember in one transaction. In SurrealDB, an agent's memory and the data it concerns are read and written together.

1BEGIN TRANSACTION;
2
3-- Recall what the agent knows about this user
4LET $context = SELECT fact, valid_from FROM memory
5 WHERE agent = agent:support AND user = user:jaime
6 ORDER BY valid_from DESC LIMIT 5;
7
8-- Remember the outcome, beside the data it concerns
9CREATE memory SET
10 agent = agent:support,
11 user = user:jaime,
12 fact = "Moved to the Memory+ plan",
13 source = conversation:4471,
14 valid_from = time::now();
15
16COMMIT TRANSACTION;

TRUSTED BY

Enterprise teams building on SurrealDB

Memory middleware,answered

Mem0 and Zep are middleware layers between the agent and its storage, abstracting over a vector store, a document store and a graph engine that stay separate. Agent Memory is the stateless application tier on SurrealDB, so facts, documents, graph relationships, vectors and their history are written in one transaction.

THE PLATFORM

Everything an application and its agents know. Five surfaces, one engine.

IN PRODUCTION

Trusted at scale. Samsung, Nvidia, Verizon, Tencent, and Walmart run on SurrealDB.

14,000+

Developers building on SurrealDB Cloud

4M+

Developers building on SurrealDB worldwide

FROM THE TEAMS

SurrealDB gives us a foundation where we can unify semantic search, knowledge graphs, and AI-driven decision making without stitching together multiple systems. Collapsing responsibility into SurrealDB has become our default engineering posture.
Justin Foley

VP of Engineering, Later

GET STARTED

Memory on the database. Agent Memory writes facts, vectors and their history in one SurrealDB transaction, with every answer traceable to its source.

ISO 27001
AICPA SOC 2 Type 2
Cyber Essentials
GDPR
Cyber Essentials Plus
SurrealDB

The context and memory layer for AI agents

Database. Graphs, vectors, documents and relational data in one engine, in a single ACID transaction.
Agent Memory. Connects and retrieves context wherever your data lives, every fact carrying its source.
Cloud. Fully managed, in the cloud provider and region you choose.

Explore with AI

Copyright © 2026 SurrealDB Ltd. Registered in England and Wales. Company no. 13615201

Registered address: 3rd Floor 1 Ashley Road, Altrincham, Cheshire, WA14 2DT, United Kingdom

Trading address: Huckletree Oxford Circus, 213 Oxford Street, London, W1D 2LG, United Kingdom