Replies: 2 comments 3 replies
-
Disclaimer: not an ADK maintainer. We have been exploring building human-in-the-loop approval mechanisms #640, and a core part of that involved how the set of Events is re-written to include only the relevant messages. Most of this is handled by native ADK in the contents processor as part of the single flow. One way to support a flexible context window management would be to provide another processor in the single flow that filters or aggregates the events before they are processed into the content. Alternatively, if you wish to take the already processed contents and further processed, you could simple do this in the before_model_callback. If you want this on all sub agents you would need to register this on every sub agent. Simple truncating the history should involve overwriting the llm_request.content. If you wish to create summaries that are sticky over time you will need to capture those summaries in the state so you can reliably recall them in future invocations. Is this what you were thinking of? I can make a simple callback to demo this if helpful. |
Beta Was this translation helpful? Give feedback.
-
I use LangChain.... I did some processing at the bottom, those interested can refer to it:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello ADK Development Team and Community,
I've been reviewing the session lifecycle documentation at https://google.github.io/adk-docs/sessions/session/. The documentation clearly explains how a session is started, context is provided to the agent, the agent processes the query, and interactions are saved.
However, I couldn't find an explicit mention of built-in mechanisms for advanced context management techniques such as sliding windows (using the last N conversation turns) or summarization (summarizing previous conversation history) to handle long conversations and potential token limits when interacting with language models (LLMs).
Regarding point "3. Agent Processing: The agent analyzes the user's query and potentially the session state and event history to determine the response," does this imply that the implementation of strategies like windowing or summarization is entirely the responsibility of the user-developed agent's logic?
If so:
I'm asking because, without context management strategies, sending the entire conversation history for each turn can quickly become inefficient and costly, especially with models that have strict input token limits. On the other hand, if each conversation or turn effectively creates a new "memory" (session), this would also eliminate continuity.
Could you please provide some clarity on how ADK is designed to handle these scenarios of long, ongoing conversations with respect to context management?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions