Context Bloat with Agent Passoff
I been constantly getting 500 errors and after looking at it closely,
- There seems to be genuinely something wrong with Google API's in the evening
But now, I see the below in my console,
agent-service-1 | {"parts":[{"text":"For context:"},{"text":"[main_browser_agent] said: .....
agent-service-1 | {"parts":[{"text":"For context:"},{"text":"[main_browser_agent] said: /*REASONING*/\nThe refined extraction attempt for \"Red Barn Robotics\" confirms that founder names and LinkedIn URLs are \"Not available on this page\" (the main directory listing). This means the information is likely on individual company detail pages.\n\nThe original task is \"extracts company and founder information including LinkedIn URLs of top 10 companies.\"\nSinc ...... .........7-0a7602921635'}}}"}],"role":"user"}
My current architecture is one orchestrator agent ---> and its sub agents. ----> Agent A, Agent B
When Agent A finishes its thing, the final response, Agent B gets almost everything Agent A did as "context" for it to understand what to do next, which makes sense in some situations.
I would like Agent B to be oblivious to everything but the prompt, and whatever state input I give it, how can I achieve this?
I have a very similar problem I know i we use the same session there's a chain of events within the session, and its somehow important to give some context to agent, but how can we limit this, I have over 200 events and the input context blows to over 30000 input tokens and hence inducing latency. Any suggestions?
I've encountered this as well, and found something that can help depending on your exact use-case.
The LlmAgent has an option called include_contents that can be used to configure this behavior: https://google.github.io/adk-docs/api-reference/python/google-adk.html#google.adk.agents.LlmAgent.include_contents
When set to 'none', the affected agent will only receive the system prompt and not any of the sub-agent output. You can still pass data between the agents by directing sub-agents to add information to state.
@JDSeiler Thanks for this, did you do this on the orchestrator agent or on the sub agent because I added it on the sub agent and didnt see any different in behaviour.
Specifically, on my sub agent I set the include_contents to None
@hangfei Would love your thoughts here too
@kanlanc The parameter should be set to 'none' on agents that you want to exclusively receive the system prompt, and no additional content like tool calls. Based on your original post, where "Agent A" was getting all the tool calls from "Agent B", you should configure include_contents on "Agent A".
In my case I had the following setup:
- A
ParallelAgentthat ran several sub-agents with their own tool calls. - A single "synthesizer" agent whose job it was to combine the results of the concurrently executed agents into a single response. (basically this pattern: https://google.github.io/adk-docs/agents/multi-agents/#parallel-fan-outgather-pattern)
The ParallelAgent and synthesizer agent are sequenced with a SequentialAgent. In order to stop the synthesizer agent from receiving all the tool calls generated by the concurrent sub-agents, I set include_contents to 'none'.
Hi @kanlanc and thanks to everyone who participated in this thread.
We're currently doing some housekeeping on our issue tracker. Given the rapid pace of development and the number of updates since this was last active, there's a good chance this issue has been resolved in a newer version. To help us keep our backlog focused on current issues, we are closing this as stale.
If you're still facing this problem, could you please update to the very latest version of the library and confirm the issue still exists? If it does, please comment here, and we will be happy to reopen this issue and investigate further.
Thanks for your contribution and understanding!