SurrealDb
Store AgentOS sessions, memory, knowledge, evals, and traces in SurrealDB.
SurrealDb implements the Db interface with SurrealDB tables for Agent, Team, and Workflow sessions, memories, knowledge, metrics, evals, traces, and spans.
| Parameter | Type | Default | Description |
|---|---|---|---|
id | Optional[str] | - | Database ID. Derived deterministically from db_url and db_db when omitted. |
client | Optional[Union[BlockingWsSurrealConnection, BlockingHttpSurrealConnection]] | - | A blocking connection, either HTTP or WebSocket. |
db_url | str | - | The SurrealDB connection URL. |
db_creds | dict[str, str] | - | Database credentials dictionary (username, password). |
db_ns | str | - | The SurrealDB namespace to use. |
db_db | str | - | The SurrealDB database name to use. |
session_table | Optional[str] | - | Name of the table to store Agent, Team and Workflow sessions. |
runs_table | Optional[str] | None | Storage name for individual runs. Defaults to agno_runs, or <session_table>_runs when a custom session name is supplied. |
memory_table | Optional[str] | - | Name of the table to store user memories. |
metrics_table | Optional[str] | - | Name of the table to store metrics. |
eval_table | Optional[str] | - | Name of the table to store evaluation runs data. |
knowledge_table | Optional[str] | - | Name of the table to store knowledge documents data. |
traces_table | Optional[str] | - | Name of the table to store traces. |
spans_table | Optional[str] | - | Name of the table to store spans. |
Methods
upsert_sessions
Insert or update multiple sessions in one method call. The adapter issues queries for each session separately.
Parameters:
sessions(List[Session]): List of sessions to upsertdeserialize(Optional[bool]): Whether to deserialize the sessions. Defaults toTrue
Returns: List[Union[Session, Dict[str, Any]]]
upsert_memories
Insert or update multiple memories in one method call. The adapter issues a separate write for each memory.
Parameters:
memories(List[UserMemory]): List of memories to upsertdeserialize(Optional[bool]): Whether to deserialize the memories. Defaults toTrue
Returns: List[Union[UserMemory, Dict[str, Any]]]