abnormal operation of the require_confirmation generated by the subagent
** Please make sure you read the contribution guide and file the issues in the right place. ** Contribution guide.
Describe the bug there is an issue that the tool confirmation created in the subagent is not transmitted to the subagent after the user confirms, and the tool cannot be found because the root agent is trying to execute the tool.
This is sent from adk-web to adk with the id value in ToolResponse, the adk runner is treated as resulable with the id taken over, causing malfunction.
If you exclude invocation_id from FE (modify ADK-web) for ToolResponse, it works normally, but I do not know if it fits the resumable concept.
To Reproduce Please share a minimal code and data to reproduce your problem. Steps to reproduce the behavior:
- attach any tool with require_confirm ,
- attach ResumabilityConfig
- query any question to use tool
- made pending msg to confirm by user
- user confirm
- adk get tool response , try to do pending tool
- got error
Expected behavior A clear and concise description of what you expected to happen. ` Traceback (most recent call last): File "adk-python/src/google/adk/cli/adk_web_server.py", line 1425, in event_generator async for event in agen: ...<7 lines>... yield f"data: {sse_event}\n\n" File "adk-python/src/google/adk/runners.py", line 455, in run_async async for event in agen: yield event File "adk-python/src/google/adk/runners.py", line 443, in _run_with_trace async for event in agen: yield event File "adk-python/src/google/adk/runners.py", line 655, in _exec_with_plugin async for event in agen: ...<9 lines>... yield (modified_event if modified_event else event) File "adk-python/src/google/adk/runners.py", line 432, in execute async for event in agen: yield event File "adk-python/src/google/adk/agents/base_agent.py", line 291, in run_async async for event in agen: yield event File "adk-python/src/google/adk/agents/llm_agent.py", line 460, in _run_async_impl async for event in agen: ...<5 lines>... should_pause = True File "adk-python/src/google/adk/flows/llm_flows/base_llm_flow.py", line 346, in run_async async for event in agen: last_event = event yield event File "adk-python/src/google/adk/flows/llm_flows/base_llm_flow.py", line 365, in _run_one_step_async async for event in agen: yield event File "adk-python/src/google/adk/flows/llm_flows/base_llm_flow.py", line 455, in _preprocess_async async for event in agen: yield event File "adk-python/src/google/adk/flows/llm_flows/request_confirmation.py", line 151, in run_async if function_response_event := await functions.handle_function_call_list_async( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<12 lines>... ): ^ File "adk-python/src/google/adk/flows/llm_flows/functions.py", line 244, in handle_function_call_list_async function_response_events = await asyncio.gather(*tasks) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "adk-python/src/google/adk/flows/llm_flows/functions.py", line 338, in _execute_single_function_call_async raise tool_error File "adk-python/src/google/adk/flows/llm_flows/functions.py", line 324, in _execute_single_function_call_async tool = _get_tool(function_call, tools_dict) File "adk-python/src/google/adk/flows/llm_flows/functions.py", line 729, in _get_tool raise ValueError(error_msg) ValueError: Tool 'kai-battery-_Get_todays_battery_report_event_list' not found. Available tools: ... tool list
Possible causes:
- LLM hallucinated the function name - review agent instruction clarity
- Tool not registered - verify agent.tools list
- Name mismatch - check for typos `
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. macOS, Linux, Windows] linux
- Python version(python -V): 3.12
- ADK version(pip show google-adk): 1.17.0 NG , 1.16.0 OK
Model Information:
- Are you using LiteLLM: Yes
- Which model is being used(e.g. gemini-2.5-pro) sonnet 4
Additional context Add any other context about the problem here.
invocation_id=id <==== here parts=[Part( function_response=FunctionResponse( id='adk-36221393-2772-47d3-b684-b8a3da2be5aa', name='adk_request_confirmation', response={ 'response': '{"hint":"Please approve or reject the tool call toolname() by responding with a FunctionResponse with an expected ToolConfirmation payload.","confirmed":true}' } )
If the FE does not send the invocation_id value to the new message when it is created, it operates normally. resume operates when invocation_id is present, causing an error.
This change was applied in "https://github.com/google/adk-web/commit/f9824b5c614f526bf47221986ffd2cb87b22e213".
https://github.com/google/adk-python/blob/main/tests/unittests/runners/test_run_tool_confirmation.py I found related test cases , but this bug case is LlmAgent with sub_agents. this case is not included.
hello. I found root condition of issue.
I set before_agent_callback=update_current_time,
def update_current_time(callback_context: CallbackContext): """Update current time to callback context""" callback_context.state["_time"] = datetime.now().isoformat()
after run before_agent_callback,
https://github.com/google/adk-python/blob/main/src/google/adk/agents/base_agent.py#L535
appened new event as last_event
if callback_context.state.has_delta(): return Event( invocation_id=invocation_context.invocation_id, author=self.name, branch=invocation_context.branch, content=after_agent_callback_content, actions=callback_context._event_actions, )
`
model_version=None content=None grounding_metadata=None partial=None turn_complete=None finish_reason=None error_code=None error_message=None interrupted=None custom_metadata=None usage_metadata=None live_session_resumption_update=None input_transcription=None output_transcription=None avg_logprobs=None logprobs_result=None cache_metadata=None citation_metadata=None invocation_id='e-5bdb322c-7f50-4fc2-b949-7b8de9c54454' author='root_agent' actions=EventActions(skip_summarization=None, state_delta={'_time': '2025-11-25T08:07:06.445999'}, artifact_delta={}, transfer_to_agent=None, escalate=None, requested_auth_configs={}, requested_tool_confirmations={}, compaction=None, end_of_agent=None, agent_state=None, rewind_before_invocation_id=None) long_running_tool_ids=None branch=None id='3effea82-1832-4d7a-9d1c-8cb9512103e5' timestamp=1764025626.446021
`
https://github.com/google/adk-python/blob/main/src/google/adk/agents/llm_agent.py#L698 last_event = events[-1] if last_event.author == self.name: # Last event is from current agent. Return transfer_to_agent in the event # if it exists, or None. return self.__get_transfer_to_agent_or_none(last_event, self.name)
so, can not transfer to sub_agent.
I hope it will be helpful for analysis.
@maxx1958 Thanks for the excellent root cause analysis.
The issue is in llm_agent.py:698 where state delta events from before_agent_callback break the subagent resume logic.
This is a regression in v1.17.0+ (works in v1.16.0).
As a workaround, either disable ResumabilityConfig or remove the state-updating before_agent_callback from your root agent.
The proper fix requires modifying _get_subagent_to_resume() to skip state-only events when determining which agent to resume.
Team is looking more into it.
@Jacksunwei Please have a look into it.
@surajksharma07 Thanks for providing workaround solution. I temporarily fixed the problem by removing delta as below.
del callback_context.state._delta["_time"]
@maxx1958 deleting the delta entry prevents the state event from being created since has_delta() returns False.
Confirmed this issue persists in v1.22.0 and v1.22.1.
While related state delta fixes were made (commit 1ee93c8b for #2992), they addressed is_final_response() logic, not the _get_subagent_to_resume() function at llm_agent.py:719-727 which still uses events[-1] without filtering state-only events.
The proper fix still requires modifying _get_subagent_to_resume() to skip state-delta-only events.
We're tracking this for an upcoming releases.
_get_subagent_to_resume() uses events[-1] raw, so a state-delta event from before_agent_callback intercepts the check and returns None instead of the subagent, causing the root agent to try executing the subagent's tool.
The related fix for is_final_response() (#2992, commit 1ee93c8) didn't extend to this function.
The fix is a small backward-scan in _get_subagent_to_resume() that skips events where content is None and actions.state_delta is set — the del-delta workaround you shared in January works in the meantime.
Closing due to no follow-up for a few months — feel free to reopen or submit a PR with the fix, happy to review!