Skip to content

feat(workflow): support bounded parallel agent workers - #7912

Closed
me-her wants to merge 1 commit into
google:mainfrom
me-her:codex/focused-agent-worker-limit
Closed

me-her wants to merge 1 commit into
google:mainfrom
me-her:codex/focused-agent-worker-limit

Conversation

@me-her

@me-her me-her commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Link to Issue or Description of Change

Closes #7641. This is the focused worker-limit change requested in #7643.

Agent/LlmAgent workers currently start every input item concurrently. Add max_parallel_workers and forward it to the existing parallel worker, so applications can bound in-flight items while preserving input-order outputs:

worker = Agent(
    name="analyzer",
    instruction="Analyze the text in the user message.",
    parallel_worker=True,
    max_parallel_workers=4,
)

The default remains unlimited. Positive limits require parallel_worker=True. Building the internal worker preserves the original Agent's configuration. The existing scheduler, cancellation, replay, and per-item retry implementations are unchanged.

Update the worker guide, add Agent-specific regression coverage, and initialize the new default field in two GEPA mock fixtures. Broader task collaboration remains under design discussion in #7642.

Testing Plan

Validation revision: e1a32f97a4ab1f042aed230a8ad6afb3bcf831a8.

  • 141 focused workflow tests passed with uv-managed Python 3.12, covering limits, ordering, validation, cloning/serialization, fail-fast cancellation, human-input resume, and per-item retry budgets.
  • All applicable pre-commit checks passed.
  • Strict mypy comparison of both changed source files reports zero new diagnostics against upstream 8cd3b12; both have the same two existing diagnostics in the same environment.
  • uv build --python 3.12 succeeded. The wheel installed into a fresh uv Python 3.12 environment passes the offline Runner smoke test: limits 1, 2, and unlimited yield peak concurrency 1, 2, and 4, with ordered outputs and no active calls left over. The model is scripted; no provider calls or credentials are required.
  • The full Linux unit matrix, Python 3.11–3.14 completed: 22,545 / 22,536 / 22,536 / 22,538 passed, respectively. Each version has 14 failures, matching the exact failing test IDs and error messages in Google's own CI on upstream base 8cd3b12. There are 15 additional passing cases and zero new failures per version. The existing failures are one A2A custom-client test and 13 telemetry metric comparisons. Both runs also have 96–98 skips, 12 expected failures, and two non-strict unexpected passes. No tests were excluded beyond the repository's existing behavior, and no dependency pins were added to hide these failures.

Checklist

  • Read CONTRIBUTING.md and independently reviewed the change.
  • Added targeted tests and updated the existing guide.
  • Focused tests, applicable static checks, and installed-wheel smoke pass.
  • Full Linux unit matrix completed; all failures verified against upstream CI.

Expose max_parallel_workers on Agent/LlmAgent and forward it to the existing parallel worker. Preserve unlimited defaults, ordered outputs, cancellation, resume, and per-item retries.

Fixes google#7641
@me-her
me-her marked this pull request as ready for review October 31, 2026 20:02
copybara-service Bot pushed a commit that referenced this pull request Nov 4, 2026
Merge #7912

Add `max_parallel_workers` to `LlmAgent`, forwarded to the existing parallel
worker when the agent is built into a workflow node. The default `None` keeps
today's unbounded behavior; a value below 1, or a value set without
`parallel_worker=True`, is rejected with a validation error.

Closes #7641

PiperOrigin-RevId: 1014093670
@adk-bot

adk-bot commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Thank you @me-her for your contribution! 🎉

Your changes have been successfully imported and merged via Copybara in commit 5e4f0e1.

Closing this PR as the changes are now in the main branch.

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

Labels

merged [Status] This PR is merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support max_parallel_workers on Agent parallel workers

3 participants