SurrealDB | The context layer for AI agents

5 min read Original article ↗

The platform that consolidates knowledge, memory and context for reliable production-scale agents.

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 eroding accuracy.

Data fragments at every system boundary

Token bills that balloon

Every store returns its own copy of the same context. Duplicate chunks inflate each prompt - and the token bill with them.

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

Two products. One foundation.

SurrealDB is the database. Spectron is the agent memory layer built on it. One transaction boundary, one permission model, one deployment - from object storage to agent memory.

03 |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 a single engine. 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

The agent writes back what it learned - memories, entities, and decisions persist for the next turn.

Memories

Entities

Decisions

Explore the multi-model engine

SPECTRON · AGENT MEMORY

Memory in the database, not above it

Spectron is our second product: the memory and knowledge layer for AI agents, sold on its own and built on SurrealDB. Because memory lives in the same engine as your data, entity extraction, knowledge graphs, temporal facts and hybrid retrieval share one transaction boundary and one permission model, with nothing bolted on top.

SPECTRON · AGENT MEMORY

Memory in the database, not above it

Spectron is our second product: the memory and knowledge layer for AI agents, sold on its own and built on SurrealDB. Because memory lives in the same engine as your data, entity extraction, knowledge graphs, temporal facts and hybrid retrieval share one transaction boundary and one permission model, with nothing 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.