Repository navigation
Conversation
In nested multi-agent architectures, when a deep sub-agent triggers a Long-Running Operation (LRO) pause, the orchestrating LlmAgent incorrectly sets end_of_agent=True for itself upon the first resumption pause. This caused subsequent resumptions to silently fail. This fixes Issue google#5349 (Bug 2) by tracking pause_invocation during sub-agent execution, aligning LlmAgent behavior with SequentialAgent and LoopAgent. Partially fixes google#5349
|
Hi team! Just a quick heads up: the CI failure is throwing a 404 NOT_FOUND for gemini-2.5-pro inside |
|
Hi @kyson-dev , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Your PR has been received by the team and is currently under review. We will provide feedback as soon as we have an update to share. |
|
Hi @sasha-gitg , can you please review this. |
|
your diagnosis was right and the guard landed. on the resume path LlmAgent._run_async_impl records a pause from the sub-agent and returns before setting end_of_agent, in 3bb1011, v2.7.0. the variable is called should_pause rather than pause_invocation, but it's the change you proposed here, and test_resume_path_does_not_end_parent_when_subagent_pauses covers it. two smaller pieces didn't land, both deliberately. wrapping the end-state emission in if ctx.is_resumable: turned out not to change behavior on that path. and the test here asserts Root never gets end_of_agent, which main now contradicts on purpose since cecc1f9. |
🔴 Required Information
Describe the Bug:
In nested multi-agent architectures (e.g.,
LlmAgent->SequentialAgent->LlmAgent), when a deep sub-agent triggers a Long-Running Operation (LRO) pause, the orchestratingLlmAgentincorrectly setsend_of_agent=Truefor itself upon the first resumption pause. This causes subsequent resumptions in the same invocation to silently fail.This PR addresses the "Bug 2" root cause detailed in Issue #5349.
Steps to Reproduce:
See Issue #5349 for the full reproduction script. The issue occurs when:
ResumabilityConfig(is_resumable=True)is used.LlmAgentdelegates to a sub-agent with LRO tools.Expected Behavior:
The orchestrating agent should only set
end_of_agent=Truewhen its sub-agent has genuinely completed execution, not when the sub-agent has paused to wait for tool confirmation.Observed Behavior:
The orchestrator immediately marks itself as finished upon the first LRO pause of its sub-agent, preventing the sub-agent from continuing its work after the first tool confirmation.
🟡 Optional Information
Proposed Changes:
src/google/adk/agents/llm_agent.py's_run_async_implto trackpause_invocationduring sub-agent execution, aligning its behavior withSequentialAgentandLoopAgent.from __future__ import annotationsto the new test file to comply with repo standards.Testing Plan:
tests/unittests/agents/test_nested_agent_resume.py.testing_utils.MockModelto deterministically simulate a deeply nested agent topology (Root->Loop->Sequential->Worker) undergoing an LRO pause (viaadk_request_confirmation).Root) does not emitend_of_agent=Trueprematurely during the pause, and properly resumes upon receiving the human response../scripts/unittests.shwith 100% test pass rate.pre-commit runlocally to ensure all formatting (pyink,isort, license headers) is compliant.Partially fixes #5349