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

Usage

Run Redis

Install docker desktop and run Redis on port 6379 using:

docker run --name my-redis -p 6379:6379 -d redis
redis_storage_for_agent.py
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 for Redis keys to namespace the sessions
    prefix="agno_test",
    # Redis host address
    host="localhost",
    # Redis port number
    port=6379,
)

# Create agent with Redis storage
agent = Agent(
    storage=storage,
)

Params

ParameterTypeDescriptionDefault
prefixstrPrefix for Redis keys to namespace the sessionsRequired
hoststrRedis host address"localhost"
portintRedis port number6379
dbintRedis database number0
passwordOptional[str]Redis password if authentication is requiredNone
modeOptional[Literal["agent", "team", "workflow"]]Storage mode"agent"

Developer Resources