Tools · Storage
Redis for AI Agent Memory
Redis serves agent memory as a fast in-memory store — ideal for short-term buffers, semantic caches and Redis Stack vector search when teams want low-latency self-hosted memory.
Redis memory tiers
Use cases
Redis use cases in agent memory
- Conversation buffer lists — LPUSH recent messages per session; trim to window size
- Session state — agent working variables, tool outputs, turn counters
- Semantic cache — cache LLM responses keyed by query embedding hash
- Redis Stack vectors — RediSearch vector index for LTM-lite without separate DB
- Pub/sub — broadcast memory updates across multi-agent workers
Comparison
Redis vs managed memory APIs
Redis gives full control and data residency; managed APIs (Engram, Mem0, Zep) ship extraction and retrieval pipelines.
| Dimension | Redis DIY | Engram / Mem0 / Zep |
|---|---|---|
| Latency | Sub-ms reads | API round-trip (Mem0 median search 0.148 s) |
| Extraction | You build it | Built-in pipelines |
| Data residency | Full control | Vendor-dependent |
| LOCOMO J | N/A (DIY) | Mem0 66.9, Zep 66.0 |
| Best for | Hot buffers, caches | Production LTM with eval |
Pattern
Building memory on Redis
Extract facts → store in RedisJSON/Hash + RediSearch vectors → retrieve on query with TTL policies.
- After each turn, LLM extracts salient facts
- Store as RedisJSON documents with
user_id,content, embedding - Index vectors in RediSearch for similarity search
- Set TTL per memory type (session vs preference)
- Pair with durable store (pgvector, Weaviate/Engram) for true LTM
FAQ
Frequently asked questions
Is Redis enough for long-term agent memory?
Redis works for short-term buffers and LTM-lite with Redis Stack vectors. For durable multi-session LTM at scale, pair Redis (hot tier) with pgvector, Weaviate/Engram or a managed memory API.
Redis vs Mem0 for agent memory?
Redis = DIY control, sub-ms latency, you build extraction/retrieval. Engram = Weaviate-native managed memory layer. Mem0 = framework-agnostic managed API. See Mem0 alternatives.
Does Redis Stack support vector search for memory?
Yes — RediSearch indexes embeddings for similarity search. Suitable for LTM-lite; graduate to dedicated vector DBs or Engram at higher scale.
What latency benefits does Redis provide?
Sub-millisecond reads for session buffers and semantic caches — ideal for hot-path memory before slower vector DB retrieval.
Redis for multi-agent memory?
Pub/sub broadcasts memory updates across workers. Shared store pattern: single Redis instance with namespace per agent. See shared memory.
Production examples of Redis agent memory?
Common pattern: Redis buffer (STM) + Engram/Mem0/pgvector (LTM). Redis alone for session state in n8n/LangChain agents with external LTM on retrieve.