Installation
Environment Variables
Quick Start
1
Simple Agent Usage
2
Direct Tool Usage
Available Methods
query(sql)
Execute a SurrealQL query.create(table, data)
Create a new record in a table.select(table, conditions=None)
Select records from a table.Multi-Model Examples
Document Data
Graph Data
Relational Data
Configuration Options
Connection URLs
Different connection formats supported:Function-Based Usage
Docker Setup
Basic SurrealDB Server
With Persistent Storage
Production Setup
Authentication
Connection Pooling
Advanced Features
Transactions
Real-time Subscriptions
Geospatial Queries
Error Handling
Common Errors
Performance Tips
- Use Prepared Statements: For repeated queries, use parameterized queries
- Batch Operations: Group multiple operations in transactions
- Index Strategy: Create indexes on frequently queried fields
- Connection Reuse: Reuse connections instead of creating new ones
SurrealQL Quick Reference
Data Types
- Basic: string, number, boolean, datetime
- Complex: object, array, geometry, duration
- Special: thing (record ID), uuid, bytes
Common Operations
Related Tools
PostgreSQL
Relational database
MongoDB
Document database
Redis
Key-value store
MySQL
Relational database
SQLite
Embedded database
Best Practices
Multi-Model Design
Multi-Model Design
Leverage SurrealDB’s multi-model capabilities for complex data — combine documents, graphs, and relations in one schema instead of forcing everything into a single model.
Namespace Organisation
Namespace Organisation
Use namespaces to separate environments (dev, staging, prod) so agents and tools never cross wires between datasets.
Security
Security
Always use authentication in production environments; avoid root credentials in agent-facing tools.
Monitoring
Monitoring
Set up monitoring for query performance and resource usage, especially when agents run ad hoc SurrealQL.
Backup Strategy
Backup Strategy
Implement regular backups for persistent storage setups before relying on agents for write-heavy workflows.

