Session State: Retain Conversation History Within a Single Interaction
AI agents forget user details mid-conversation without session state, mimicking a 'goldfish memory problem' where brilliance fails due to amnesia. Implement session state in Google Agent Development Kit (ADK) by creating a session object that holds full conversation history. This ensures the agent recalls prior inputs, like user preferences for historic sites in Tokyo, to generate coherent multi-day itineraries. Demo shows agent planning Day 1 (Imperial Palace), confirming it, then building a full 3-day plan without repetition—directly fixing short-term forgetfulness for natural, human-like interactions.
Multi-Agent State: Share Context Across Collaborating Agents
In team-based agent apps, individual agents can't coordinate without shared state, a digital folder storing key-value pairs accessible session-wide. Foodie agent saves restaurant 'destination' (e.g., best sushi in Palado), which navigation agent reads via prompt curly braces {destination}. Orchestrate via root sequential agent calling foodie first, then navigation. ADK web UI visualizes state values, enabling seamless handoffs—agents 'talk' indirectly, producing directions post-restaurant selection. Trade-off: in-memory only, lost on restarts.
Persistence: Survive Restarts with Database-Backed Sessions
In-memory sessions vanish on app closure or reboots, erasing all progress. Swap ADK's in-memory service for database session service to persist conversations across days, weeks, or months, enabling personalized recall of preferences. Retrieve prior session, build context from it, and prepend to new queries. This delivers 'personal assistant' feel, remembering long-term user history despite system interruptions—essential for production reliability over ephemeral demos.