Async SQLite
Store agent sessions and run history asynchronously in SQLite with AsyncSqliteDb.
AsyncSqliteDb stores Agent sessions and run history asynchronously in SQLite. Use async Agent methods such as arun() and aprint_response().
Usage
Install the sqlalchemy asyncio extra, aiosqlite, and openai:
uv pip install "sqlalchemy[asyncio]" aiosqlite openaiAsyncSqliteDb uses an async db_engine, then db_url, then db_file. A db_url must use an async driver such as sqlite+aiosqlite. If none is provided, it creates agno.db in the current directory.
from agno.agent import Agent
from agno.db.sqlite import AsyncSqliteDb
db = AsyncSqliteDb(db_file="tmp/data.db")
agent = Agent(db=db)Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
id | Optional[str] | - | The ID of the database instance. UUID by default. |
db_engine | Optional[AsyncEngine] | - | The SQLAlchemy async database engine to use. |
db_url | Optional[str] | - | The database URL to connect to. |
db_file | Optional[str] | - | The database file to connect to. |
session_table | Optional[str] | - | Name of the table to store Agent, Team and Workflow sessions. |
runs_table | Optional[str] | None | Storage name for individual runs. Defaults to agno_runs, or <session_table>_runs when a custom session name is supplied. |
memory_table | Optional[str] | - | Name of the table to store user 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 documents data. |
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. |
components_table | Optional[str] | None | Components table name for migration compatibility (defaults to agno_components). Async adapters do not yet support component reads or writes. |
learnings_table | Optional[str] | - | Name of the table to store learnings. |
schedules_table | Optional[str] | - | Name of the table to store cron schedules. |
schedule_runs_table | Optional[str] | - | Name of the table to store schedule run history. |
approvals_table | Optional[str] | - | Name of the table to store human approval requests. |
auth_tokens_table | Optional[str] | - | Name of the table to store OAuth tokens for external services. |
service_accounts_table | Optional[str] | - | Name of the table to store service accounts. |