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

# Sqlite 存储

Agno 支持使用 `SqliteStorage` 类将 Sqlite 作为 Agent 的存储后端。

## 用法

你需要提供 `db_url`、`db_file` 或 `db_engine`。以下示例使用了 `db_file`。

```python sqlite_storage_for_agent.py theme={null}
from agno.storage.sqlite import SqliteStorage

# 使用 Sqlite 数据库创建存储后端
storage = SqliteStorage(
    # 将 session 存储在 ai.sessions 表中
    table_name="agent_sessions",
    # db_file: Sqlite 数据库文件
    db_file="tmp/data.db",
)

# 将存储添加到 Agent
agent = Agent(storage=storage)
```

## 参数

<Snippet file="storage-sqlite-params.mdx" />

## 开发者资源

* 查看 [Cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/storage/sqllite_storage/sqlite_storage_for_agent.py)
