Context caching and compression
Long instructions and long chats make every model call slower and more expensive. See how ContextCacheConfig reuses a stable prefix and how EventsCompactionConfig summarises old history.
10 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 10 minutes.
Written from the official documentation
In this module: Context, sessions and memory
- Agent contextWhat each callback and tool can see.Pro
- SessionsOne conversation, its events and its lifecycle.Pro
- StateSession, user, app and temp prefixes.Pro
- MemoryRemembering across sessions.Pro
- ArtifactsFiles and binary data, versioned.Pro
- EventsThe event stream that drives everything.Pro
- Context caching and compressionCutting cost and fitting long histories.Pro
- Rewind and migrate sessionsGoing back in time; moving storage.Pro