Singlestore for Agent
Kern supports using Singlestore as a storage backend for Agents using the SingleStoreDb class.
Usage
Obtain the credentials for Singlestore from here
1from os import getenv23from kern.agent import Agent4from kern.db.singlestore.singlestore import SingleStoreDb5from kern.tools.hackernews import HackerNewsTools67# Configure SingleStore DB connection8USERNAME = getenv("SINGLESTORE_USERNAME")9PASSWORD = getenv("SINGLESTORE_PASSWORD")10HOST = getenv("SINGLESTORE_HOST")11PORT = getenv("SINGLESTORE_PORT")12DATABASE = getenv("SINGLESTORE_DATABASE")1314db_url = (15 f"mysql+pymysql://{USERNAME}:{PASSWORD}@{HOST}:{PORT}/{DATABASE}?charset=utf8mb4"16)1718db = SingleStoreDb(db_url=db_url)1920# Create an agent with SingleStore db21agent = Agent(22 db=db,23 tools=[HackerNewsTools()],24 add_history_to_context=True,25)26agent.print_response("How many people live in Canada?")27agent.print_response("What is their national anthem called?")Params
| Parameter | Type | Default | Description |
|---|---|---|---|
id | Optional[str] | - | The ID of the database instance. UUID by default. |
db_engine | Optional[Engine] | - | The SQLAlchemy database engine to use. |
db_schema | Optional[str] | - | The database schema to use. |
db_url | Optional[str] | - | The database URL to connect to. |
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 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 content. |
traces_table | Optional[str] | - | Name of the table to store traces. |
spans_table | Optional[str] | - | Name of the table to store spans. |