Overview
Redis tool allows you to interact with Redis for caching, key-value storage, and pub/sub messaging.Installation
Environment Variables
Quick Start
How It Works
Usage with Agent
Available Methods
get(key)
Get a value by key.set(key, value, ttl=None)
Set a key-value pair with optional TTL.delete(key)
Delete a key.keys(pattern)
Find keys matching a pattern.hget/hset
Hash operations.Docker Setup
Common Errors
| Error | Cause | Solution |
|---|---|---|
redis not installed | Missing dependency | Run pip install redis |
Connection refused | Redis not running | Start Redis server |
NOAUTH | Authentication required | Provide password |
Best Practices
Load the password from the environment
Load the password from the environment
Read
REDIS_PASSWORD from the environment instead of hard-coding it in the tool call.Set a TTL on cached keys
Set a TTL on cached keys
set(key, value, ttl=3600) expires keys automatically. Use TTLs so agent-written cache entries do not grow unbounded.Use scoped key patterns
Use scoped key patterns
Namespace keys (e.g.
user:123:name) so agents can filter with keys(pattern) without scanning the whole store.Related Tools
MongoDB
NoSQL database
PostgreSQL
SQL database
Upstash
Serverless Redis

