Repository navigation
Conversation
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
6 tasks done
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
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_workersand forward it to the existing parallel worker, so applications can bound in-flight items while preserving input-order outputs: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.8cd3b12; both have the same two existing diagnostics in the same environment.uv build --python 3.12succeeded. 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.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