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

1
Buffer
2
Cache
3
Vectors
4
Pub/sub

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

Short-term memory · Storage backends

Comparison

Redis vs managed memory APIs

Redis gives full control and data residency; managed APIs (Engram, Mem0, Zep) ship extraction and retrieval pipelines.

DimensionRedis DIYEngram / Mem0 / Zep
LatencySub-ms readsAPI round-trip (Mem0 median search 0.148 s)
ExtractionYou build itBuilt-in pipelines
Data residencyFull controlVendor-dependent
LOCOMO JN/A (DIY)Mem0 66.9, Zep 66.0
Best forHot buffers, cachesProduction LTM with eval

Mem0 alternatives · Open-source vs managed

Pattern

Building memory on Redis

Extract facts → store in RedisJSON/Hash + RediSearch vectors → retrieve on query with TTL policies.

  1. After each turn, LLM extracts salient facts
  2. Store as RedisJSON documents with user_id, content, embedding
  3. Index vectors in RediSearch for similarity search
  4. Set TTL per memory type (session vs preference)
  5. Pair with durable store (pgvector, Weaviate/Engram) for true LTM

Build long-term memory · Forgetting and eviction

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.