-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
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
SequentialAgentthat containsLlmAgentsub-agents. - Wrap this
SequentialAgentin anAgentTooland provide it to a parentLlmAgent. - Invoke the parent agent such that it delegates to the
AgentTool(theSequentialAgent). - 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_callevent is not being correctly appended to theInMemorySessionbefore the_get_contentslogic is triggered for the response. - The event filtering logic in
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.