Memory Management
Agent Kernel provides a sophisticated memory management system with multiple layers designed for different use cases and lifecycles. Understanding these layers helps you build efficient, context-aware agents that don't bloat LLM prompts.
Memory Architecture
Memory Layers
Agent Kernel provides three distinct memory layers, each with different purposes and lifecycles.
1. Conversational State (Short-term Memory)
Purpose: Store conversation history and agent state that becomes part of the LLM context.
Lifecycle: Session-scoped, persists across multiple requests within a session.
Characteristics:
- ✅ Automatically managed by framework adapters
- ✅ Included in LLM context window
- ✅ Persists across agent invocations
- ⚠️ Contributes to token usage
- ⚠️ Should not contain large data (files, documents)
Managed By: Framework-specific runners (OpenAI, LangGraph, CrewAI, ADK)
What's Stored:
- User messages and agent responses
- Multi-turn conversation history
- Agent state and context
- Framework-specific metadata
You Don't Manage This Directly: The framework adapters automatically handle conversation persistence.
Learn about session management →
2. Auxiliary Memory (Smart Caching)
Purpose: Store additional data needed by tools and hooks without bloating the LLM context.
Agent Kernel provides two types of auxiliary caches with identical APIs but different lifecycles:
Volatile Cache (Request-Scoped)
Lifecycle: Cleared automatically after each request completes.
Perfect For: