Conversation Memory + Valkey

5 cookbooks covering every aspect of conversation memory with Valkey - from basic chat history to semantic search, caching, and agent state management.

01

Getting Started

Connect with GLIDE, store chat messages in a LIST, retrieve conversation history, and auto-expire sessions with TTL.

Beginner~15 minPython
02

Session Management

Track session metadata with HASH - user ID, model, token count, timestamps. List active sessions and implement sliding window history.

Intermediate~15 minPython
03

Semantic Memory

Store conversation embeddings with JSON.SET and search by meaning with FT.SEARCH KNN. Find relevant past context across all sessions.

Intermediate~20 minPython
04

Semantic Caching

Cache LLM responses by meaning, not exact match. Skip expensive API calls when a similar question was already answered.

Advanced~20 minPython
05

Agent State & Tool Results

Checkpoint agent reasoning with HASH, log tool calls to STREAM, and resume multi-step workflows after interruption.

Advanced~25 minPython

🎮 Try It Live

Watch Valkey commands fire in real-time as conversations are stored, searched, and cached.

Open Interactive Demo
📦 valkeyforai Repo