The Question
Is there any configuration parameter that prevents ADK from automatically sending the previous agent’s output in chat history?
I’m working with ADK’s SequentialAgent and discovered that when using template variables like {summary} to selectively inject specific data into the system instruction, ADK also automatically adds the ENTIRE output from the previous agent to the conversation contents as [previous_agent] said: {...}.
I tried include_contents='none' on the second agent, but this only removes the initial user message - the agent transition messages still appear, resulting in data duplication.
The Problem
ADK’s SequentialAgent uses TWO data-passing mechanisms simultaneously:
-
Template Injection (explicit in examples):
{summary}replaced with data fromcontext.state['summary']- Injected into system instruction
-
Automatic Chat History (implicit behavior):
- ADK automatically adds:
[summarizer_agent] said: {entire output dictionary} - Added to conversation contents/chat history
- Passes the FULL agent output, not just selected fields
- ADK automatically adds:
Example
# Agent 1
summarizer_agent = Agent(
output_key="summary", # Saves to context.state['summary']
...
)
# Agent 2
translator_agent = Agent(
instruction="""
ARTICLE SUMMARY:
{summary} # ← Template variable for SPECIFIC data injection
Translate this to Spanish...
""",
include_contents='none', # Tried this - doesn't eliminate agent transitions
)
Observed Behavior:
{
"system_instruction": "...ARTICLE SUMMARY:\n{'title': '...', 'key_points': [...]}...",
"contents": [
{
"text": "[summarizer_agent] said: {\n 'title': '...',\n 'key_points': [...]\n}",
"role": "user"
}
]
}
Impact
For pipelines with large structured data payloads, this duplication causes:
- Increased token usage (10-30% overhead observed)
- Non-ideal prompts with redundant information
- Potential LLM confusion from seeing the same data in different formats
Environment:
- ADK Version: 1.16.0
- Python
- SequentialAgent with
output_key+ template variable pattern
Related Discussion:
Also posted to GitHub Discussions - no resolution yet.
Would appreciate any guidance on configuration options or best practices!