> ## Documentation Index
> Fetch the complete documentation index at: https://docs.upsonic.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# AsyncSqliteStorage

> Async SQLite database storage for local development

## Overview

`AsyncSqliteStorage` provides an asynchronous file-based SQLite storage backend using SQLAlchemy with aiosqlite. Ideal for async applications, local development, and single-node deployments.

## Install

<Note>
  Install the SQLite storage optional dependency group:

  ```bash theme={null}
  uv pip install "upsonic[sqlite-storage]"
  ```
</Note>

## Basic Usage

```python theme={null}
import asyncio
from upsonic import Agent, Task
from upsonic.storage.memory import Memory
from upsonic.storage.sqlite import AsyncSqliteStorage

async def main():
    storage = AsyncSqliteStorage(db_file="memory.db")

    memory = Memory(
        storage=storage,
        session_id="session_001",
        user_id="user_123",
        full_session_memory=True,
        summary_memory=True,
        user_analysis_memory=True,
        model="anthropic/claude-sonnet-4-5"
    )

    agent = Agent("anthropic/claude-sonnet-4-5", memory=memory)

    result1 = await agent.do_async(Task("My name is Alice"))
    result2 = await agent.do_async(Task("What's my name?"))
    print(result2)  # "Your name is Alice"

asyncio.run(main())
```

## Parameters

| Parameter           | Type          | Default | Description                                                           |
| ------------------- | ------------- | ------- | --------------------------------------------------------------------- |
| `db_file`           | `str`         | `None`  | Path to the SQLite database file                                      |
| `db_url`            | `str`         | `None`  | SQLAlchemy async database URL (e.g., `sqlite+aiosqlite:///./data.db`) |
| `db_engine`         | `AsyncEngine` | `None`  | Pre-configured SQLAlchemy AsyncEngine                                 |
| `session_table`     | `str`         | `None`  | Custom name for the session table                                     |
| `user_memory_table` | `str`         | `None`  | Custom name for the user memory table                                 |
| `knowledge_table`   | `str`         | `None`  | Custom name for the knowledge registry table (used by KnowledgeBase)  |
| `id`                | `str`         | `None`  | Unique identifier for this storage instance                           |

<Note>
  If no connection parameter is provided, the storage defaults to creating `./upsonic.db` in the current directory.
</Note>
