Memory with Redis
Store user memories in Redis by passing RedisDb as the agent's database.
Code
from agno.agent import Agent
from agno.db.redis import RedisDb
# Setup Redis
# Initialize Redis db (use the right db_url for your setup)
db = RedisDb(db_url="redis://localhost:6379")
# Create agent with Redis db
agent = Agent(
db=db,
update_memory_on_run=True,
)
agent.print_response("My name is John Doe and I like to play basketball on the weekends.")
agent.print_response("What do I do on weekends?")Usage
Set up your virtual environment
uv venv --python 3.12
source .venv/bin/activateSet environment variables
export OPENAI_API_KEY=xxxInstall dependencies
uv pip install -U agno openai redisRun Redis
docker run --name my-redis -p 6379:6379 -d redisRun Example
python mem-redis-memory.py