Skip to main content
Agno supports using SurreabDB as a database with the SurrealDb class. You can get started with SurreabDB following their documentation. Run SurreabDB locally with the following command:
docker run --rm --pull always -p 8000:8000 surrealdb/surrealdb:latest start --user root --pass root

Usage

surrealdb_for_agent.py
from agno.agent import Agent
from agno.db.surrealdb import SurrealDb

# SurrealDB connection parameters
SURREALDB_URL = "ws://localhost:8000"
SURREALDB_USER = "root"
SURREALDB_PASSWORD = "root"
SURREALDB_NAMESPACE = "agno"
SURREALDB_DATABASE = "surrealdb_for_agent"

creds = {"username": SURREALDB_USER, "password": SURREALDB_PASSWORD}
db = SurrealDb(None, SURREALDB_URL, creds, SURREALDB_NAMESPACE, SURREALDB_DATABASE)

agent = Agent(db=db)

Params

ParameterTypeDefaultDescription
idOptional[str]-The ID of the database instance. UUID by default.
clientOptional[Union[BlockingWsSurrealConnection, BlockingHttpSurrealConnection]]-A blocking connection, either HTTP or WebSocket.
db_urlstr-The SurrealDB connection URL.
db_credsdict[str, str]-Database credentials dictionary (username, password).
db_nsstr-The SurrealDB namespace to use.
db_dbstr-The SurrealDB database name to use.
session_tableOptional[str]-Name of the table to store Agent, Team and Workflow sessions.
memory_tableOptional[str]-Name of the table to store user memories.
metrics_tableOptional[str]-Name of the table to store metrics.
eval_tableOptional[str]-Name of the table to store evaluation runs data.
knowledge_tableOptional[str]-Name of the table to store knowledge documents data.
culture_tableOptional[str]-Name of the table to store cultural knowledge data.

Developer Resources