> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# SingleStore

> Persist Agno sessions and other data in SingleStore.

`SingleStoreDb` stores Agent, Team, and Workflow sessions, memories, knowledge, evaluations, and traces in [SingleStore](https://www.singlestore.com/).

Use the [Helios endpoint details](https://docs.singlestore.com/cloud/connect-to-singlestore/singlestore-helios-endpoints/) for the connection values below. See [Connect with Python](https://docs.singlestore.com/cloud/developer-resources/connect-with-application-development-tools/connect-with-python/) for driver setup.

## Usage

Install Agno, SQLAlchemy, PyMySQL, and the OpenAI client:

```shell theme={null}
uv pip install -U agno sqlalchemy pymysql openai
```

Set the SingleStore connection values and your model provider API key:

```bash Mac/Linux theme={null}
export SINGLESTORE_USERNAME="your_username"
export SINGLESTORE_PASSWORD="your_password"
export SINGLESTORE_HOST="your_host"
export SINGLESTORE_PORT="3306"
export SINGLESTORE_DATABASE="your_database"
export OPENAI_API_KEY="your_openai_api_key_here"
```

```powershell Windows theme={null}
$Env:SINGLESTORE_USERNAME="your_username"
$Env:SINGLESTORE_PASSWORD="your_password"
$Env:SINGLESTORE_HOST="your_host"
$Env:SINGLESTORE_PORT="3306"
$Env:SINGLESTORE_DATABASE="your_database"
$Env:OPENAI_API_KEY="your_openai_api_key_here"
```

```python singlestore_for_agent.py theme={null}
from os import getenv

from agno.agent import Agent
from agno.db.singlestore import SingleStoreDb
from sqlalchemy import URL

db_url = URL.create(
    drivername="mysql+pymysql",
    username=getenv("SINGLESTORE_USERNAME"),
    password=getenv("SINGLESTORE_PASSWORD"),
    host=getenv("SINGLESTORE_HOST"),
    port=int(getenv("SINGLESTORE_PORT", "3306")),
    database=getenv("SINGLESTORE_DATABASE"),
    query={"charset": "utf8mb4"},
).render_as_string(hide_password=False)

db = SingleStoreDb(db_url=db_url)
agent = Agent(db=db)
```

## Parameters

<Snippet file="db-singlestore-params.mdx" />


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.