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

# Redis Storage

Agno supports using Redis as a storage backend for Agents using the `RedisStorage` class.

## Usage

### Run Redis

Install [docker desktop](https://docs.docker.com/desktop/install/mac-install/) and run **Redis** on port **6379** using:

```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

# Initialize Redis storage with default local connection
storage = RedisStorage(
    prefix="agno_test",    # Prefix for Redis keys to namespace the sessions
    host="localhost",      # Redis host address
    port=6379,             # Redis port number
)

# Create agent with Redis storage
agent = Agent(
    storage=storage,
    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?")

# Verify storage contents
print("\nVerifying storage contents...")
all_sessions = storage.get_all_sessions()
print(f"Total sessions in Redis: {len(all_sessions)}")

if all_sessions:
    print("\nSession details:")
    session = all_sessions[0]
    print(f"Session ID: {session.session_id}")
    print(f"Messages count: {len(session.memory['messages'])}")
```

## Params

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

## Developer Resources

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