redis-py

Official Python client for Redis — the in-memory data structure store. redis-py provides sync and async (aioredis integrated into redis-py 4.x+) interfaces to all Redis data types (strings, hashes, lists, sets, sorted sets, streams), pub/sub, Lua scripting, and Redis Cluster/Sentinel. The standard Python Redis client used across frameworks including Django cache backend, Celery broker, and FastAPI caching.

Evaluated Mar 06, 2026 (0d ago) v5.x
Homepage ↗ Repo ↗ Developer Tools redis python cache queue pub-sub async official open-source
⚙ Agent Friendliness
65
/ 100
Can an agent use this?
🔒 Security
84
/ 100
Is it safe for agents?
⚡ Reliability
86
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
88
Error Messages
85
Auth Simplicity
90
Rate Limits
85

🔒 Security

TLS Enforcement
88
Auth Strength
82
Scope Granularity
78
Dep. Hygiene
90
Secret Handling
82

Redis AUTH password required in production. TLS connection (redis+ssl://) for cloud deployments. Redis ACL in Redis 6+ for user-level permissions. Never expose Redis port publicly — internal network only.

⚡ Reliability

Uptime/SLA
88
Version Stability
88
Breaking Changes
82
Error Recovery
88
AF Security Reliability

Best When

You need fast in-memory caching, session storage, pub/sub messaging, or rate limiting with the standard Python Redis client.

Avoid When

You need persistent ACID-compliant storage — Redis is a cache/message broker, not a primary database.

Use Cases

  • Cache expensive database queries or API responses with TTL-based expiration using Redis strings and hashes
  • Implement session storage for web applications with Redis as the session backend
  • Use Redis pub/sub for real-time event broadcasting between Python services
  • Build rate limiting using Redis atomic increment and expiry (INCR + EXPIRE pattern)
  • Use async redis client (AsyncRedis) with FastAPI or async Python services for non-blocking Redis access

Not For

  • Persistent data storage requiring ACID guarantees — Redis is in-memory with optional persistence
  • Complex relational queries — use PostgreSQL or MySQL; Redis excels at key-value and simple data structures
  • Applications that can't afford Redis infrastructure — Redis requires a running Redis server

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: api_key
OAuth: No Scopes: No

Redis AUTH password passed in connection URL or redis.Redis(password=). Redis 6+ ACL user authentication also supported.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

redis-py library is free. Redis server is SSPL licensed (open source with enterprise restrictions). Redis Cloud is the managed offering.

Agent Metadata

Pagination
cursor
Idempotent
Full
Retry Guidance
Documented

Known Gotchas

  • redis-py 4.x merged aioredis — use redis.asyncio.Redis for async access; old import from aioredis package no longer works with new versions
  • All Redis values are stored as bytes — redis-py returns bytes by default; use decode_responses=True in Redis() constructor to auto-decode to strings
  • Connection pooling is used by default (ConnectionPool) — redis.Redis() creates a pool, not a single connection; never close the pool in the middle of requests
  • Pipeline commands are buffered and sent atomically — if one command fails, others still execute; pipeline doesn't rollback; use MULTI/EXEC transactions for all-or-nothing semantics
  • Redis KEYS pattern command is O(N) and blocks server — never use KEYS in production; use SCAN for non-blocking iteration over keys
  • TTL returns -1 for keys without expiry, -2 for non-existent keys — agents must handle both cases; not distinguishing causes bugs when checking expiry

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for redis-py.

$99

Scores are editorial opinions as of 2026-03-06.

5215
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered