Bug
LlmAgent._run_async_impl resume path (lines 478-484 in llm_agent.py) unconditionally sets end_of_agent=True after a sub-agent returns, even when the sub-agent paused for a long-running tool call.
# Current code (llm_agent.py:474-484)
if agent_state is not None and (
agent_to_transfer := self._get_subagent_to_resume(ctx)
):
async with Aclosing(agent_to_transfer.run_async(ctx)) as agen:
async for event in agen:
yield event
# BUG: unconditional — doesn't check if sub-agent paused
ctx.set_agent_state(self.name, end_of_agent=True)
yield self._create_agent_state_event(ctx)
return
The LLM flow path (lines 486-505) correctly guards with should_pause checks. The resume path is missing the same guards.
Impact
Multi-step HITL workflows break when using Runner.run_async() natively (e.g. via adk web). After the first long-running tool round-trip through a sub-agent, the parent agent sets end_of_agent=True, causing the runner to early-return on subsequent resumes and silently dropping tool responses.
Reproduction
- Create a parent
LlmAgent with a sub-agent
- Sub-agent has a long-running tool (e.g.
is_long_running=True)
- Run through
adk web or native Runner
- Complete first tool call → resume → sub-agent calls another tool
- Second tool result is silently dropped
Proposed Fix
Add should_pause guard to the resume path, matching the LLM flow path:
if agent_state is not None and (
agent_to_transfer := self._get_subagent_to_resume(ctx)
):
should_pause = False
async with Aclosing(agent_to_transfer.run_async(ctx)) as agen:
async for event in agen:
yield event
if ctx.should_pause_invocation(event):
should_pause = True
if should_pause:
return
ctx.set_agent_state(self.name, end_of_agent=True)
yield self._create_agent_state_event(ctx)
return
Environment
- google-adk 1.33.0
- Python 3.11
Bug
LlmAgent._run_async_implresume path (lines 478-484 inllm_agent.py) unconditionally setsend_of_agent=Trueafter a sub-agent returns, even when the sub-agent paused for a long-running tool call.The LLM flow path (lines 486-505) correctly guards with
should_pausechecks. The resume path is missing the same guards.Impact
Multi-step HITL workflows break when using
Runner.run_async()natively (e.g. viaadk web). After the first long-running tool round-trip through a sub-agent, the parent agent setsend_of_agent=True, causing the runner to early-return on subsequent resumes and silently dropping tool responses.Reproduction
LlmAgentwith a sub-agentis_long_running=True)adk webor nativeRunnerProposed Fix
Add
should_pauseguard to the resume path, matching the LLM flow path:Environment