Documentation Index
Fetch the complete documentation index at: https://spacesail.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Code
cookbook/memory/db/mem-redis-memory.py
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,
enable_user_memories=True,
)
agent.print_response("My name is John Doe and I like to play basketball on the weekends.")
agent.print_response("What's do I do in weekends?")
Usage
Create a virtual environment
Open the Terminal and create a python virtual environment.python3 -m venv .venv
source .venv/bin/activate
Set environment variables
export OPENAI_API_KEY=xxx
Install libraries
pip install -U agno openai redis
Run Redis
docker run --name my-redis -p 6379:6379 -d redis
Run Example
python cookbook/memory/db/mem-redis-memory.py