SurrealDB Memory Backend
SurrealDB is an optional memory backend that provides:- ✅ Native vector search (no BLOB storage needed)
- ✅ Graph queries (relationships between memories)
- ✅ Multi-node support (distributed memory)
- ✅ Real-time subscriptions
- ✅ SurrealQL (SQL-like query language)
SurrealDB support requires the
memory-surreal feature flag:Configuration
Authentication
Option 1: Username/PasswordInstallation
Local Development
Docker
Production (TLS)
Schema
Fromsrc/memory/surreal.rs:
Vector Search
Native Vector Support
SurrealDB has first-class vector support:Graph Queries
Defining Relationships
Creating Relationships
Querying Graphs
Hybrid Search Implementation
Fromsrc/memory/surreal.rs:
Real-Time Subscriptions
Subscribe to memory changes:Multi-Node Setup
Cluster Configuration
Client Configuration
Use load balancer or round-robin:Performance Tuning
Connection Pooling
Batch Operations
Backup and Restore
Export Database
Import Database
Comparison: SQLite vs SurrealDB
| Feature | SQLite | SurrealDB |
|---|---|---|
| Setup | Zero config | Requires server |
| Performance (local) | Faster | Comparable |
| Performance (remote) | N/A | 10-50ms latency |
| Vector search | Manual (BLOB) | Native |
| Graph queries | Not supported | First-class |
| Multi-node | Not supported | Supported |
| Real-time | Not supported | Live queries |
| Maintenance | None | Server upkeep |
When to Use SurrealDB
Use SurrealDB if you need:
- Graph relationships between memories
- Multi-node distributed memory
- Real-time memory updates
- Centralized memory across agents