| [ Web Proxy ] |
| Viewing: https://adk.dev/integrations/../../tutorials/../../../tools/../tools-custom/../../sessions/ | [Back] [Original] |
[logo]
Meaningful, multi-turn conversations require agents to understand context. Just
like humans, they need to recall the conversation history: what's been said and
done to maintain continuity and avoid repetition. The Agent Development Kit
(ADK) provides structured ways to manage this context through Session,
State, and Memory.
Think of different instances of your conversations with the agent as distinct conversation threads, potentially drawing upon long-term knowledge.
Session: The Current Conversation Thread
Events) during that specific interaction.Session can also hold temporary data (State) relevant only during
this conversation.State (session.state): Data Within the Current Conversation
Session.Memory: Searchable, Cross-Session Information
ADK provides services to manage these concepts:
SessionService: Manages the different conversation threads (Session
objects)
Events, modifying State), and deleting individual Sessions.MemoryService: Manages the Long-Term Knowledge Store (Memory)
Sessions) into the
long-term store.Implementations: ADK offers different implementations for both
SessionService and MemoryService, allowing you to choose the storage backend
that best fits your application's needs. Notably, in-memory implementations
are provided for both services; these are designed specifically for local
testing and fast development. It's important to remember that all data
stored using these in-memory options (sessions, state, or long-term knowledge)
is lost when your application restarts. For persistence and scalability beyond
local testing, ADK also offers cloud-based and database service options.
In Summary:
Session & State: Focus on the current interaction the history
and data of the single, active conversation. Managed primarily by a
SessionService.MemoryService.In the following sections, we'll dive deeper into each of these components:
Session: Understanding its structure and Events.State: How to effectively read, write, and manage session-specific
data.SessionService: Choosing the right storage backend for your sessions.MemoryService: Exploring options for storing and retrieving broader
context.Understanding these concepts is fundamental to building agents that can engage in complex, stateful, and context-aware conversations.
| Web Proxy Viewer | New URL | Original Page |