Giving your AI agent a "scratchpad" memory

By Google Cloud Tech

Share:

Key Concepts

  • AI Agents: Artificial intelligence programs designed to perform tasks, often through conversational interfaces.
  • ADK: An unspecified framework or environment where AI agent conversations and state management occur.
  • Session: A single, continuous interaction or "phone call" with an AI agent.
  • State: A dynamic, real-time "scratch pad" within a session that tracks specific information relevant to the current interaction.
  • Short-term Memory: The temporary nature of the "state," which is wiped clean at the end of a session.
  • Model: The core AI component responsible for processing information and generating responses.
  • Tools: Specific functionalities or actions that an AI agent can invoke (e.g., submit answer).
  • Personalization: The ability of an AI agent to remember past interactions and tailor future responses or experiences to a specific user.
  • Persistent Memory: The ability to store information beyond a single session, making it available for future interactions even if the application crashes.

AI Agent Memory: Sessions and Short-Term State

AI agents, particularly within the ADK environment, are designed to manage information during interactions. Every conversation with an AI agent is encapsulated within a session, which can be conceptualized as a single, continuous "phone call." Central to each session is the state, described as a "dynamic scratch pad." This state actively tracks various pieces of information relevant to the ongoing interaction, such as the current question index, the number correct in a quiz, and the user's overall quiz score.

Real-time Interaction with State

The state is highly dynamic and interactive. Both the underlying AI model and the various tools available to the agent possess the capability to read from and update this state in real-time. A concrete example provided is when a user submits an answer: the dedicated submit answer tool instantly updates the user's score within the state. This immediate update allows the AI agent to reflect the new score back to the user without delay, demonstrating a responsive and interactive experience.

Limitations of Short-Term Memory

Despite its utility for real-time interaction, the state within a session represents short-term memory. The critical limitation is that once a session concludes – "when the call ends" – the dynamic scratch pad, along with all the information it contained, is "wiped." While this short-term memory is highly effective and useful for managing the flow and data of a single interaction, it is explicitly stated as "not enough if we want true personalization." The inability to retain information across sessions prevents the AI agent from building a long-term understanding of the user or their preferences.

Transition to Persistent Memory

The discussion concludes by highlighting the necessity of moving beyond short-term memory. The next logical step, and the subject of subsequent exploration, is how to make this "scratch pad" persistent. The goal is to ensure that the information stored within it endures even if the application crashes, thereby enabling true personalization and a more continuous, informed interaction experience over time.

Synthesis/Conclusion

This segment introduces the foundational concept of AI agent memory within the ADK framework, focusing on the "session" and its associated "state" as a dynamic, real-time scratch pad. While this short-term memory mechanism allows for immediate updates and responsive interactions (e.g., updating quiz scores), its ephemeral nature—being wiped at session end—is identified as a significant barrier to achieving true personalization. The video sets the stage for exploring persistent memory solutions to overcome this limitation, emphasizing the need for information retention beyond single interactions.

Chat with this Video

AI-Powered

Load the transcript when you're ready to chat so the initial page stays lighter.

Ready to summarize another video?

Summarize YouTube Video