Describe the bug
ValueError: No function call event found for function responses ids occurs in google-adk==1.22.1 when using a SequentialAgent wrapped in an AgentTool. This error signifies a mismatch/missing event in the conversation history, specifically when a sub-agent within the SequentialAgent completes a tool call. Downgrading to google-adk==1.21.0 resolves the issue.
To Reproduce
- Define a
SequentialAgent that contains LlmAgent sub-agents.
- Wrap this
SequentialAgent in an AgentTool and provide it to a parent LlmAgent.
- Invoke the parent agent such that it delegates to the
AgentTool (the SequentialAgent).
- Inside the
SequentialAgent, one of the sub-agents performs a tool call (e.g., using an MCP tool).
- Upon receiving the tool result, the framework fails with:
ValueError: No function call event found for function responses ids: {'adk-xxxx-xxxx-...'}
Stacktrace:
File ".../google/adk/flows/llm_flows/contents.py", line 442, in _get_contents
result_events = _rearrange_events_for_latest_function_response(
filtered_events
)
File ".../google/adk/flows/llm_flows/contents.py", line 195, in _rearrange_events_for_latest_function_response
raise ValueError(
'No function call event found for function responses ids:'
f' {function_responses_ids}'
)
ValueError: No function call event found for function responses ids: {'adk-31549d8b-460a-428c-80ec-edd43bb8c30d'}
Expected behavior
The internal InMemorySessionService created by AgentTool should correctly persist and associate function_call events with their subsequent function_response events, allowing the SequentialAgent to continue execution without a ValueError.
Screenshots
N/A
Desktop (please complete the following information):
- OS: macOS (15.2)
- Python version(python -V): 3.14.0 (also observed on 3.13)
- ADK version(pip show google-adk): Broken in 1.22.1, works in 1.21.0.
Model Information:
- Are you using LiteLLM: No
- Which model is being used:
gemini-3-flash-preview (also observed with others)
Additional context
The issue seems specific to the nested session logic in AgentTool. AgentTool creates a new InMemorySessionService for each call (agent_tool.py:155). In 1.22.1, it appears that either:
- The
function_call event is not being correctly appended to the InMemorySession before the _get_contents logic is triggered for the response.
- The event filtering logic in
contents.py (specifically _rearrange_events_for_latest_function_response) is filtering out the function_call due to branch mismatch or some other criteria introduced/changed in 1.22.1.
Describe the bug
ValueError: No function call event found for function responses idsoccurs ingoogle-adk==1.22.1when using aSequentialAgentwrapped in anAgentTool. This error signifies a mismatch/missing event in the conversation history, specifically when a sub-agent within theSequentialAgentcompletes a tool call. Downgrading togoogle-adk==1.21.0resolves the issue.To Reproduce
SequentialAgentthat containsLlmAgentsub-agents.SequentialAgentin anAgentTooland provide it to a parentLlmAgent.AgentTool(theSequentialAgent).SequentialAgent, one of the sub-agents performs a tool call (e.g., using an MCP tool).Stacktrace:
Expected behavior
The internal
InMemorySessionServicecreated byAgentToolshould correctly persist and associatefunction_callevents with their subsequentfunction_responseevents, allowing theSequentialAgentto continue execution without aValueError.Screenshots
N/A
Desktop (please complete the following information):
Model Information:
gemini-3-flash-preview(also observed with others)Additional context
The issue seems specific to the nested session logic in
AgentTool.AgentToolcreates a newInMemorySessionServicefor each call (agent_tool.py:155). In1.22.1, it appears that either:function_callevent is not being correctly appended to theInMemorySessionbefore the_get_contentslogic is triggered for the response.contents.py(specifically_rearrange_events_for_latest_function_response) is filtering out thefunction_calldue to branch mismatch or some other criteria introduced/changed in1.22.1.