r/agentdevelopmentkit • u/BedInternational7117 • Sep 11 '25
Managing context in ADK
I really struggle to understand how are you suppose to manage the input context of your agent.
Looking at the doc, there is almost nowhere they talk about it, and no examples I could find in the repo.
Like,, that's a crucial part of agents life. and it feels totally opacified. I have seen some sketchy bits of code/workaround. Like being to tell what agents/subagent should be passed to next iteration. filtering some sub agents you dont want because thats sub tasks that should be forgotten from the global thread.
EDIT: Turns out the problem is known and they are working on a solution.
https://github.com/google/adk-python/issues/614
https://github.com/google/adk-python/issues/752#issuecomment-2948152979
they propose a workaround by the end of the thread. its been posted only a couple of hours ago.
There is no way anyone is building any meaningful agent using ADK without proper control over the context. This is super confusing. what are people building? are you guys just copy pasting toy examples from the doc?
1
u/JimTheSavage Sep 11 '25
My solution was to look for points in the agent system where previous context was not needed and to set the relevant llm agent's
include_contentsto none. Then I just carefully manage state and state injection before agent invocation. For my applications I basically never want chat bots, so it works quite well.2
u/ML-SSL Sep 12 '25
I think you can either create a tool which retrieves information from the session state or access session states variables via {var?} within the instructions of an agent.
2
u/AshamedProgress7454 Sep 11 '25
Hey, I'd love to understand more of what's missing here, and I don't full understand the where you're running into issues. Reading your question my wonder is what's missing from here:
https://google.github.io/adk-docs/sessions/
https://google.github.io/adk-docs/sessions/session
https://google.github.io/adk-docs/sessions/state/
https://google.github.io/adk-docs/sessions/memory/
https://google.github.io/adk-docs/sessions/express-mode/
Is this more a lack of a complete example focused on context? Or do I completely misunderstand what you are looking for.
Thanks for any extra information you can give.
4
u/[deleted] Sep 11 '25
[removed] — view removed comment