Skip to content

fix(agents): only stop ParallelAgent on direct sub-agent escalation - #1491

Open
mithun-sudo wants to merge 1 commit into
google:mainfrom
mithun-sudo:fix/parallel-agent-nested-escalation
Open

fix(agents): only stop ParallelAgent on direct sub-agent escalation#1491
mithun-sudo wants to merge 1 commit into
google:mainfrom
mithun-sudo:fix/parallel-agent-nested-escalation

Conversation

@mithun-sudo

@mithun-sudo mithun-sudo commented Sep 9, 2026

Copy link
Copy Markdown

Match adk-python: nested escalate events must not cancel sibling branches. Adds regression test for LoopAgent nested under ParallelAgent.

Link to Issue or Description of Change

1. Link to an existing issue (if applicable):

Problem:
ParallelAgent stops all parallel branches when any event has escalate=true, including escalation from nested sub-agents (e.g. an agent inside a LoopAgent sub-branch). adk-python only stops when the escalating event's author is a direct sub-agent (_asks_this_agent_to_exit).

Solution:
Filter takeUntil with asksThisAgentToExit(), which requires both escalate=true and event.author() in the set of direct sub-agent names. Matches adk-python parity without changing behavior for direct sub-agent escalation (existing test still passes).

Testing Plan

Unit Tests:

  • I have added or updated unit tests for my change.
  • All unit tests pass locally.

Summary:

  • ./mvnw -pl core clean compile test -Dtest=ParallelAgentEscalationTest2 tests passed
  • ./mvnw -Prelease clean packageBUILD SUCCESS
  • Verified regression: runAsync_nestedLoopEscalation_keepsSiblingBranchesRunning fails on main (stream completes after 1 nested escalate) and passes with this change
  • runAsync_escalationEvent_shortCircuitsOtherAgents still passes (direct sub-agent escalate still short-circuits siblings)

Manual End-to-End (E2E) Tests:

Not applicable — behavior covered by unit tests; no user-facing API or runtime config change.

Checklist

  • I have read the CONTRIBUTING.md document.
  • My pull request contains a single commit.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • I have manually tested my changes end-to-end.
  • Any dependent changes have been merged and published in downstream modules.

Additional context

Python reference:

  • src/google/adk/agents/parallel_agent.py_asks_this_agent_to_exit
  • tests/unittests/agents/test_parallel_agent.pytest_run_async_keeps_siblings_when_a_nested_loop_ends_itself

@hemasekhar-p hemasekhar-p self-assigned this Sep 10, 2026
Match adk-python: nested escalate events must not cancel sibling branches.
Adds regression test for LoopAgent nested under ParallelAgent.
@hemasekhar-p
hemasekhar-p force-pushed the fix/parallel-agent-nested-escalation branch from 30bda8e to 47810f7 Compare September 10, 2026 05:58
@hemasekhar-p

Copy link
Copy Markdown
Contributor

Hi @mithun-sudo, thank you for your contribution. we appreciate you taking the time to submit this PR. It is currently under review by our team, and we will keep you updated if any additional information is required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ParallelAgent stops sibling branches on nested sub-agent escalation

2 participants