RedisDb stores Agent, Team, and Workflow sessions, memories, knowledge, evaluations, and traces in Redis.
Usage
Install theredis and openai packages:
Run Redis
Install Docker Desktop, then start Redis on port6379:
redis_for_agent.py
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Persist Agno sessions and other data in Redis.
RedisDb stores Agent, Team, and Workflow sessions, memories, knowledge, evaluations, and traces in Redis.
redis and openai packages:
uv pip install redis openai
6379:
docker run -d \
--name my-redis \
-p 6379:6379 \
redis
from agno.agent import Agent
from agno.db.redis import RedisDb
db = RedisDb(db_url="redis://localhost:6379")
agent = Agent(db=db)
| Parameter | Type | Default | Description |
|---|---|---|---|
id | Optional[str] | - | The ID of the database instance. UUID by default. |
redis_client | Optional[Union[Redis, RedisCluster]] | - | Redis client instance to use. If not provided a new client will be created from db_url. Required for Redis Cluster connections. |
db_url | Optional[str] | - | Redis connection URL (e.g., "redis://localhost:6379/0" or "rediss://user:pass@host:port/db"). Supports single-node Redis only. |
db_prefix | str | "agno" | Prefix for all Redis keys. |
expire | Optional[int] | - | TTL for Redis keys in seconds. |
session_table | Optional[str] | - | Name of the table to store sessions. |
memory_table | Optional[str] | - | Name of the table to store memories. |
metrics_table | Optional[str] | - | Name of the table to store metrics. |
eval_table | Optional[str] | - | Name of the table to store evaluation runs. |
knowledge_table | Optional[str] | - | Name of the table to store knowledge documents. |
culture_table | Optional[str] | - | Name of the table to store cultural knowledge. |
traces_table | Optional[str] | - | Name of the table to store traces. |
spans_table | Optional[str] | - | Name of the table to store spans. |
Was this page helpful?