# SingleStore (/database/providers/singlestore/overview)



`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 [#usage]

Start in a [virtual environment](/sdk/setup).

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

```shell
uv pip install -U agno sqlalchemy pymysql openai
```

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

<CodeBlockTabs defaultValue="Mac/Linux">
  <CodeBlockTabsList>
    <CodeBlockTabsTrigger value="Mac/Linux">
      Mac/Linux
    </CodeBlockTabsTrigger>

    <CodeBlockTabsTrigger value="Windows">
      Windows
    </CodeBlockTabsTrigger>
  </CodeBlockTabsList>

  <CodeBlockTab value="Mac/Linux">
    ```bash
    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"
    ```
  </CodeBlockTab>

  <CodeBlockTab value="Windows">
    ```powershell
    $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"
    ```
  </CodeBlockTab>
</CodeBlockTabs>

```python title="singlestore_for_agent.py"
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 [#parameters]

| Parameter         | Type               | Default | Description                                                                                                      |
| ----------------- | ------------------ | ------- | ---------------------------------------------------------------------------------------------------------------- |
| `id`              | `Optional[str]`    | -       | Database ID. Derived deterministically from the URL (or engine URL) and schema when omitted.                     |
| `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.                                                                    |
| `runs_table`      | `Optional[str]`    | -       | Name of the table to store runs for each session.                                                                |
| `traces_table`    | `Optional[str]`    | -       | Name of the table to store traces.                                                                               |
| `spans_table`     | `Optional[str]`    | -       | Name of the table to store spans.                                                                                |
| `versions_table`  | `Optional[str]`    | -       | Name of the table to store schema versions.                                                                      |
| `create_schema`   | `bool`             | `True`  | Whether to create the database schema if it doesn't exist. Set to `False` when the schema is managed externally. |
