How to Handle Topic Switching in Google ADK Without Carrying Old Context #3896
Replies: 1 comment
-
|
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: Google ADK provides the primitives for managing context (primarily via Hello! That's a great question, and a common challenge in building sophisticated chatbots. You are correct that ADK uses a Currently, ADK does not have a built-in mechanism to automatically detect a topic change and clear the relevant context. This logic is the responsibility of the developer to implement based on the specific needs of the application. Here are a few established patterns and strategies you can use in ADK to handle this: 1. Limit Conversation History with
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm building a chatbot using Google ADK, and I’m running into an issue with how context is maintained within a session.
If a user is having a conversation and he mentions a project_id (just as an example) early in the conversation, ADK correctly uses it for follow-up questions, which is correct, and that conversation come to an end. However, if the same user later asks a completely different question—sometimes 20–30 minutes later— and mentions project_id, but in a different context, ADK still uses that old project_id even though the new question is unrelated.
I understand that ADK uses the session_id to maintain a continuous conversation, similar to how a chat window works. But in real usage, users often switch topics within the same chat window, just like ChatGPT. Creating a brand-new session every time the user changes topics doesn’t feel practical or natural.
So my main question is:
What is the recommended way in Google ADK to detect when a user has changed topics and to clear or refresh the conversational context so the model doesn't reuse outdated values like a previous project_id? Do as a developer we need to take care of this or
does google ADK tracks it and is it recorded in any of their metadata table like events ?
Any guidance or established patterns for handling topic transitions within the same session would be very helpful.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions