Compaction
Watch a 40-turn chat grow too big for the model, then see two ways to shrink it. A sliding window that forgets old turns, and a token budget pipeline that summarises them and keeps the key facts.
11 minPro
Checking your access…
Inside this lesson
- An animation you play, pause and step through, with each part saying what it is doing.
- The real code beside it, with the lines for each step lit up.
- Practice mode, where you route each message yourself, and a short quiz.
- About 11 minutes.
Written from the official documentation
In this module: Conversations and memory
- Sessions and multi-turn chatsKeeping a conversation going.Pro
- Memory with context providersAdding what the agent should remember.Pro
- Chat history storage and memory backendsWhere history lives: the service, Redis, Cosmos DB or Mem0.Pro
- CompactionShrinking a long history so it fits the context window.Pro
- RAG and vector storesGrounding answers with vector search over your own data.Pro