Singlestore

Use SingleStore for agent session storage and persistence.

Kern supports using Singlestore as a database with the SingleStoreDb class.

You can get started with Singlestore following their documentation.

Usage

1from os import getenv
2
3from kern.agent import Agent
4from kern.db.singlestore import SingleStoreDb
5
6# Configure SingleStore DB connection
7USERNAME = getenv("SINGLESTORE_USERNAME")
8PASSWORD = getenv("SINGLESTORE_PASSWORD")
9HOST = getenv("SINGLESTORE_HOST")
10PORT = getenv("SINGLESTORE_PORT")
11DATABASE = getenv("SINGLESTORE_DATABASE")
12db_url = (
13 f"mysql+pymysql://{USERNAME}:{PASSWORD}@{HOST}:{PORT}/{DATABASE}?charset=utf8mb4"
14)
15
16# Setup your Database
17db = SingleStoreDb(db_url=db_url)
18
19# Create an agent with SingleStore db
20agent = Agent(db=db)

Params

ParameterTypeDefaultDescription
idOptional[str]-The ID of the database instance. UUID by default.
db_engineOptional[Engine]-The SQLAlchemy database engine to use.
db_schemaOptional[str]-The database schema to use.
db_urlOptional[str]-The database URL to connect to.
session_tableOptional[str]-Name of the table to store Agent, Team and Workflow sessions.
memory_tableOptional[str]-Name of the table to store 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 content.
traces_tableOptional[str]-Name of the table to store traces.
spans_tableOptional[str]-Name of the table to store spans.