SurreabDB
Use SurrealDB for agent session storage.
Kern 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:
1docker run --rm --pull always -p 8000:8000 surrealdb/surrealdb:latest start --user root --pass rootUsage
1from kern.agent import Agent2from kern.db.surrealdb import SurrealDb34# SurrealDB connection parameters5SURREALDB_URL = "ws://localhost:8000"6SURREALDB_USER = "root"7SURREALDB_PASSWORD = "root"8SURREALDB_NAMESPACE = "kern"9SURREALDB_DATABASE = "surrealdb_for_agent"1011creds = {"username": SURREALDB_USER, "password": SURREALDB_PASSWORD}12db = SurrealDb(None, SURREALDB_URL, creds, SURREALDB_NAMESPACE, SURREALDB_DATABASE)1314agent = Agent(db=db)Params
| Parameter | Type | Default | Description |
|---|---|---|---|
id | Optional[str] | - | The ID of the database instance. UUID by default. |
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. |
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. |
culture_table | Optional[str] | - | Name of the table to store cultural knowledge data. |
traces_table | Optional[str] | - | Name of the table to store traces. |
spans_table | Optional[str] | - | Name of the table to store spans. |