> ## 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.

# JSON Agent 存储

Agno 支持使用 `JsonStorage` 类将本地 JSON 文件作为 Agent 的存储后端。

## 用法

```python json_storage_for_agent.py theme={null}
"""运行 `pip install duckduckgo-search openai` 来安装依赖。"""

from agno.agent import Agent
from agno.storage.json import JsonStorage
from agno.tools.duckduckgo import DuckDuckGoTools

agent = Agent(
    storage=JsonStorage(dir_path="tmp/agent_sessions_json"),
    tools=[DuckDuckGoTools()],
    add_history_to_messages=True,
)
agent.print_response("How many people live in Canada?")
agent.print_response("What is their national anthem called?")
```

## 参数

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

## 开发者资源

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