Example

storage.py
from phi.storage.agent.singlestore import S2AgentStorage

# Create a storage backend using the SingleStore database
storage = S2AgentStorage(
    # store sessions in the ai.sessions table
    table_name="agent_sessions",
    # db_engine: SingleStore database engine
    db_engine=db_engine,
    # schema: SingleStore schema
    schema="ai",
)

# Add storage to the Agent
agent = Agent(storage=storage)

Params

ParameterTypeDefaultDescription
table_namestr-Name of the table to be used.
schemaOptional[str]"ai"Schema name.
db_urlOptional[str]NoneDatabase URL, if provided.
db_engineOptional[Engine]NoneDatabase engine to be used.
schema_versionint1Version of the schema.
auto_upgrade_schemaboolFalseIf true, automatically upgrades the schema when necessary.