@chat-adapter/state-redis
Production state adapter for Chat SDK using the official redis package.
Installation
Usage
createRedisState() auto-detects the REDIS_URL environment variable, so you can call it with no arguments:
To provide a URL explicitly:
Using an existing client
If you already have a connected Redis client, pass it directly:
Key prefix
All keys are namespaced under a configurable prefix (default: "chat-sdk"):
Configuration
*Either url, REDIS_URL env var, or client is required.
Environment variables
For serverless deployments (Vercel, AWS Lambda), use a serverless-compatible Redis provider like Upstash.
Key structure
Production recommendations
- Use Redis 6.0+ for best performance
- Enable Redis persistence (RDB or AOF)
- Use Redis Cluster for high availability
- Set appropriate memory limits
Features
License
MIT