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

# Redis Agent 存储

Agno 支持使用 Redis 作为 Agent 的存储后端，通过 `RedisStorage` 类。

## 用法

### 运行 Redis

安装 [docker desktop](https://docs.docker.com/desktop/install/mac-install/) 并使用以下命令在端口 **6379** 上运行 **Redis**：

```bash theme={null}
docker run --name my-redis -p 6379:6379 -d redis
```

```python redis_storage_for_agent.py theme={null}
from agno.agent import Agent
from agno.storage.redis import RedisStorage
from agno.tools.duckduckgo import DuckDuckGoTools

# 初始化 Redis 存储，使用默认的本地连接
storage = RedisStorage(
    # 用于 Redis 键的前缀，为会话提供命名空间
    prefix="agno_test",
    # Redis 主机地址
    host="localhost",
    # Redis 端口号
    port=6379,
)

# 使用 Redis 存储创建 Agent
agent = Agent(
    storage=storage,
)
```

## 参数

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

## 开发者资源

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