LLMs are stateless. Every request starts from zero with no memory of who you are, what you said, or what matters to you. This demo shows how Redis changes that by giving an AI assistant short-term and long-term memory, turning a forgetful chatbot into one that actually learns.
This demo walks through three stages of memory:
1. No Memory - The assistant has zero context. Ask it your name twice and it won't remember. This is the default LLM experience.
2. Short-Term Memory - Redis stores the conversation history for the current session. The assistant can reference earlier messages, but everything disappears when the session ends.
3. Long-Term Memory - Redis persists facts about you across sessions. The assistant knows your name, your preferences, and your history, even in a brand new conversation. Facts are extracted two ways:
- Regex - Instant, deterministic pattern matching for common phrases like "my name is..." or "Remember that..."
- AMS (Agent Memory Server) - LLM-powered extraction that understands freeform language, runs discretely in the background
- Docker Desktop (running)
- Redis Insight (for inspecting stored memory and vector data)
- Anthropic API key (for chat-bot interactions)
- OpenAI API key (for AMS embeddings and extraction)
cp .env.example .envOpen .env and fill in your two API keys:
| Variable | Purpose |
|---|---|
ANTHROPIC_API_KEY |
Powers the Claude chat backend |
OPENAI_API_KEY |
Powers AMS: embeddings (text-embedding-3-small) and extraction models (gpt-4o, gpt-4o-mini) |
Everything else in .env.example has sensible defaults, image versions, model names, vector dimensions, etc. You shouldn't need to change them unless you want to swap models or tune behavior.
Then start the stack:
docker compose up --buildFind your ports:
docker compose psOpen the frontend URL in your browser, which can be found in docker, and start chatting.
docker compose down # stop services
docker compose down -v # stop + wipe all Redis dataTry these sample prompts in long-term mode with Regex extraction to see instant fact storage:
Semantic (timeless facts about identity and preferences):
My name is MatthewI prefer dark modeRemember that the deploy key rotates every 90 days
Episodic (time-bound events tied to a specific date):
We shipped the new API on March 10I attended KubeCon on April 3Our next conference is RedisConf on June 15
Switch to AMS extraction and say the same things in your own words to see how LLM-powered extraction handles freeform language.
Toggle between all three modes in the UI to see the difference in real time.
The demo pre-loads a set of long-term memories on startup. To customize or remove them, edit
backend/seeds/devrel_long_term_memories.jsonor delete them from the frontend.
┌─────────────┐ ┌──────────────────┐ ┌───────────────────────┐
│ Frontend │ HTTP │ Backend │ SDK │ Agent Memory Server │
│ React/Nginx├────────►│ FastAPI ├───────►│ (AMS) │
│ │ │ │ │ Async LLM extraction │
└─────────────┘ └───────┬──────────┘ └───────────┬───────────┘
│ │
│ Anthropic API │ OpenAI Embeddings
▼ │
┌──────────────┐ │
│ Claude │ │
│ (Haiku) │ │
└──────────────┘ │
▼
┌─────────────────┐
│ Redis │
│ JSON + Search │
│ │
│ Working Memory │
│ Long-Term Facts│
│ Vector Index │
└─────────────────┘
Data flow:
- User sends a message from the React frontend
- Backend loads relevant memory from Redis (session history + long-term facts)
- Claude generates a response with full context
- The conversation turn is saved to working memory
- Facts are extracted via regex (instant) and/or AMS (async, ~10s) and persisted to Redis
| Problem | Fix |
|---|---|
| Chat fails but frontend loads | Check ANTHROPIC_API_KEY and OPENAI_API_KEY in .env |
| AMS extractions never appear | Verify AMS is healthy: docker compose logs agent-memory-server |
| Can't find the right port | Run docker compose port frontend 80 |
- Claude Opus 4.6 (Anthropic) - Primary coding assistant via Claude Code. Used for scaffolding, architecture, and documentation.
- ChatGPT 5.4 (OpenAI) - Second perspective for brainstorming and reviewing approaches.
- FastAPI (v0.115.12) - Web framework for the API layer.
- Anthropic Python SDK (v0.94.0) - Client library for Claude.
- pydantic-settings (v2.9.1) - Environment variable management.
- React (v19.2.5) - UI library for the chat interface.
- Vite (v8.0.8) - Build tool with hot module reload.
- Docker Compose - Container orchestration for all four services.
- Agent Memory Server (AMS) - Manages working memory, long-term fact extraction, and semantic retrieval.
- RedisVL - Vector similarity library used internally by AMS for embedding storage and search.
- Redis Insight - GUI for browsing keys, inspecting stored memory, and viewing vector data in Redis.
