Skip to content

Support sub-agent escalation event in ParallelAgent#5105

Open
jinnigu wants to merge 2 commits intogoogle:mainfrom
jinnigu:feature/subagent-escalation
Open

Support sub-agent escalation event in ParallelAgent#5105
jinnigu wants to merge 2 commits intogoogle:mainfrom
jinnigu:feature/subagent-escalation

Conversation

@jinnigu
Copy link
Copy Markdown

@jinnigu jinnigu commented Apr 2, 2026

Please ensure you have read the contribution guide before creating a pull request.

Link to Issue or Description of Change

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

2. Or, if no issue exists, describe the change:

Problem:
ParallelAgent does not short-circuit when a sub-agent emits an escalation event (actions.escalate = True). Other sub-agents continue running to completion unnecessarily. This is the Python counterpart of google/adk-java#561, resolved in google/adk-java#612.

Solution:
When any sub-agent emits an escalation event, the ParallelAgent now yields the event, cancels all remaining sub-agent tasks, and marks itself as complete in resumable mode. This works for both the Python 3.11+ (TaskGroup) and pre-3.11 code paths.

Testing Plan

Unit Tests:

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

  • All unit tests pass locally.

  • test_run_async_short_circuits_other_agents_on_escalate_action — parameterized over is_resumable (True/False) x use_pre_3_11_merge (True/False) = 4 test variants. Verifies the slow agent is cancelled, post-escalation events are suppressed, correct event ordering, and proper end_of_agent state in resumable mode.

  • test_resumable_parallel_agent_escalation_short_circuits_persisted_run — integration test using InMemoryRunner that verifies events are correctly persisted to the session store and that re-running a completed escalated invocation is a no-op.

  • All 15 tests pass (12 in test_parallel_agent.py, 3 in test_resume_invocation.py), no regressions.

Manual End-to-End (E2E) Tests:

N/A — behavior is fully covered by unit and integration tests.

Checklist

  • I have read the CONTRIBUTING.md document.
  • 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

  • Java counterpart: google/adk-java#612
  • LoopAgent already supports escalation; this brings ParallelAgent to parity.

@adk-bot adk-bot added the core [Component] This issue is related to the core interface and implementation label Apr 2, 2026
@rohityan rohityan self-assigned this Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core [Component] This issue is related to the core interface and implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support sub-agent escalation event in ParallelAgent

3 participants