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.

ParameterTypeDefaultDescription
idOptional[str]-Database ID. Derived deterministically from db_url and db_db when omitted.
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.
runs_tableOptional[str]NoneStorage name for individual runs. Defaults to agno_runs, or <session_table>_runs when a custom session name is supplied.
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.
traces_tableOptional[str]-Name of the table to store traces.
spans_tableOptional[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 upsert
  • deserialize (Optional[bool]): Whether to deserialize the sessions. Defaults to True

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 upsert
  • deserialize (Optional[bool]): Whether to deserialize the memories. Defaults to True

Returns: List[Union[UserMemory, Dict[str, Any]]]