SurrealDB | The context layer for AI agents (original) (raw)
The only database that unifies every data model - and agent memory - in a single ACID transaction.
Prefer your terminal? Install and run it locally:
curl -sSf https://install.surrealdb.com | sh
01 |THE PROBLEM → THE FIX
Agents fail due to context. Not models.
Your model can reason. It just has nothing reliable to reason over. Each failure below has a structural fix - built into the engine.
Context that leaks at every seam
Data flows between six systems. Relationships, history, and metadata fragment at every boundary, silently.
Data fragments at every system boundary
Writes that half-succeed
Memory updates in one system, state fails in another. Without unified transactions, partial writes corrupt context.
Single transaction
Committed
Inconsistent state
Rolled back
Latency that compounds
Every system adds a network hop. Round trips stack under load until agents miss their response window.
Six systems to keep alive
Six failure modes, six monitoring setups, six sets of credentials. The glue code becomes the product.
Vector DB
Similarity search
Graph DB
Relationship store
Doc store
Raw document index
Auth service
Identity & tokens
Five systems. Five auth configs. Five things to scale, secure, and keep alive.
02 |THE PLATFORM
Build and run agents on the context layer
Object storage to agent memory. One transaction boundary. One permission model. One deployment.
03 |MULTI-MODEL
Six databases become one
Put an end to stitching databases together. SurrealDB unifies your entire context layer in a single multi-model engine - one query language, one transaction, one deployment.
Before - Multiple databases
6 SDKs · 6 drivers · 6 connection pools
Vector
database
Proprietary API
Full-text search
database
Search DSL
Time-series
database
InfluxQL / Flux
Document
database
SQL / MQL
Graph
database
Cypher / Gremlin
Eventual consistency only
After - SurrealDB
1 SDK · 1 driver · 1 connection pool
Single ACID transactionStrong consistency
THE ARCHITECTURE
One stack. Four layers. Every layer under one roof.
Spectron gives agents persistent memory. SurrealDB unifies every data model in one ACID transaction. The storage engine separates compute from storage on commodity object storage.
Applications
Entity extraction
Knowledge graph
Temporal facts
Hybrid retrieval
Documents
Graphs
Vectors
Time-series
Auth
APIs
Quorum consensus
Compute-storage sep.
Scale to zero
Object storage
(S3 / GCS / Azure Blob)
04 |HOW IT WORKS
The read-think-write loop
Every agent turn resolves in one ACID transaction. No stale reads, no partial writes, no glue code.
READ
Graph traversal, vector search, and temporal facts - one SurrealQL statement, one round trip.
SurrealQL
Multi-model query
Unified result set
THINK
Documents, relationships, embeddings, and history arrive together. The agent reasons over complete context.
Result set
Multi-model query output
Documents
Relations
Vectors
History
Complete context
WRITE
Persist decisions, update entities, trigger events - one ACID transaction, no partial writes.
SURREALQL
One query. Every model.
Graph traversals, vector search, transactions, and access control in one expressive language. Explore real-world query patterns across search, graphs, agents, and more.
Multi-model query
Graph, vector, and temporal data in one round trip
-- Combine graph traversal, vector similarity, and temporal
-- filtering into a single round trip. No ORMs, no joins,
-- no glue code between datastores.
LET $vec = fn::embed("running shoes");
SELECT
->purchased->product AS history,
->reviewed->product[WHERE
vector::similarity::cosine(
embedding, $vec
) > 0.8
] AS relevant,
->prefs[WHERE valid_at <= time::now()] AS prefs
FROM ONLY $user;
TRY IT LIVE
Run SurrealQL without leaving.
A real SurrealDB instance, pre-loaded with the Surreal Deal sample store. Edit the query and hit run - no signup, no install.
SPECTRON
Memory in the database, not above it
Spectron is the first agent memory system with ACID transactions across all data models. Entity extraction, knowledge graphs, temporal facts, and hybrid retrieval, built into SurrealDB, not bolted on top.
SPECTRON
Memory in the database, not above it
Spectron is the first agent memory system with ACID transactions across all data models. Entity extraction, knowledge graphs, temporal facts, and hybrid retrieval, built into SurrealDB, not bolted on top.
PROVEN IN PRODUCTION
In production at
Samsung, Verizon,
Tencent & PolyAI.
Teams are building on the context layer across industries. Here's what they've shipped.
TRUSTED BY THE BEST
The SurrealDB integration was seamless and delivered performance on par with our internal stack. It proves that enterprises can bring their own knowledge base without sacrificing speed, quality, or control.
Colman Yau
VP of Engineering, PolyAI
SurrealDB is enabling the next phase of our product. It gives us the flexibility and graph-native capabilities we need to keep innovating for customers at every size and industry.
Or Weis
CEO & Co-founder, Permit.io
We replaced 5 backend tools with SurrealDB and scaled to 700,000 users in 8 hours.
SurrealDB fast tracked our progress with all its features. Graph links + Record links + Full text search + Vector embeddings and Vector search + Surreal WASM for offline-ability... just name it!
Sigismond
Community developer
I'm certainly enjoying that I can replace hundreds of lines of Postgres trigger and function code with a dozen characters in a DEFINE statement in SurrealDB.
Trevor Parscal
Community developer
SurrealDB has allowed our team to focus more on product and iteration without worrying about database constraints. We can do literally everything we need in SurrealDB.
Albert Marashi
Community developer
So much easier to write advanced queries compared to SQL. Queries are actually readable! Community on Discord is also very helpful and includes SurrealDB developers.
@BeniaminDudek
Community developer
PolyAI case studyPermit.io case studyAspire case studySee all case studies
BY THE NUMBERS
700K
Users on Aspire
Scaled in 8 hours after replacing 5 backend tools with SurrealDB.
50M
Graph edges at Tencent
Across 8M nodes at 10,000+ QPS on a single context graph.
~30ms
RAG latency at PolyAI
Vector search on par with their internal stack - no perceptible delay.
BENCHMARKED IN THE OPEN
Faster with every release
SurrealDB 3.x against 2.x across CRUD, batches, scans, and indexed queries - measured with the open-source crud-bench harness on the same hardware.
↑ 31%
Faster CRUD
Mean across creates, reads, updates, deletes - 2.x to 3.x
↑ 58%
Faster batches
Mean across batched operations - 2.x to 3.x
↑ 11894%
Faster full-table scans
Mean across non-indexed read scans - 2.x to 3.x
↑ 136%
Faster indexed queries
Mean across indexed read scans - 2.x to 3.x
USE CASES
From agents to real-time apps
Context-aware agents, persistent memory, knowledge graphs, and real-time collaboration - see what teams are building on the context layer.
Unified context, memory, and knowledge graphs for agents that reason - not just retrieve.Persistent, structured memory - working, semantic, episodic, and procedural - for agents that remember.Model rich relationships and dependencies. Traverse connections, rank entities, and retrieve structured context - one query, one round trip.Live queries push changes to subscribers as they commit. No polling, no message broker, no stale reads.
FREQUENTLY ASKED QUESTIONS
Learn more about the context layer
THE COMMUNITY
Building the future together
Join a growing community of developers, engineers, and teams building the next generation of intelligent applications on SurrealDB.
Stay in the loop
Product announcements, technical deep dives, AI agent recipes, and event invites - in your inbox every two weeks.
GET STARTED
Start building with the context layer
Object storage to agent memory. A single stack, a single transaction, zero glue code.