feat(agents): add max_concurrent_agent_runs to YAML config and API - #9444
feat(agents): add max_concurrent_agent_runs to YAML config and API#9444Ilya Matiach (imatiach-msft) wants to merge 1 commit into
Conversation
Mirrors the pattern introduced for max_stalls in Azure#9314. ## Problem Evaluating large datasets sequentially takes O(n×t) time and frequently hits the 6-hour FAOS job timeout. The evaluation service already supports parallel agent invocations via the \item_generation_params.max_concurrency\ field in the \�zure_ai_target_completions\ data source, but there was no way to set this from the optimize YAML config. ## Change Add \max_concurrent_agent_runs\ (YAML-only, no CLI flag, following the same policy as \max_stalls\) to: 1. \opt_eval.Options\ struct (yaml.go) — YAML key \max_concurrent_agent_runs\ 2. \optimize_api.OptimizeOptions\ struct (models.go) — JSON key \max_concurrent_agent_runs\ 3. \OptimizeConfig.ToRequest()\ (optimize_config.go) — forwarded to API 4. \OptimizeConfig.Validate()\ — rejects values < 1 ## Usage \\\yaml options: eval_model: gpt-4.1 optimization_model: gpt-5 max_concurrent_agent_runs: 8 # run 8 agent calls in parallel per eval \\\ ## Tests 8 new tests covering: YAML parsing (present/absent), Validate rejection of 0, Validate acceptance of positive values, ToRequest forwarding to API, ToRequest nil when omitted.
|
Azure Pipelines: Successfully started running 1 pipeline(s). 19 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
|
Thank you for your contribution Ilya Matiach (@imatiach-msft)! We will review the pull request and get back to you soon. |
There was a problem hiding this comment.
🟡 Changes recommended
Repository lint/convention violations and missing API serialization coverage should be addressed.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
Adds YAML-configurable concurrency for agent optimization evaluations and forwards it to the service API.
Changes:
- Adds
max_concurrent_agent_runsto YAML and API models. - Validates positive values and forwards the setting.
- Adds parsing, validation, and forwarding tests.
File summaries
| File | Description |
|---|---|
internal/pkg/agents/optimize_api/models.go |
Adds the API request field. |
internal/pkg/agents/opt_eval/yaml.go |
Adds the YAML option. |
internal/pkg/agents/opt_eval/yaml_test.go |
Tests YAML parsing and omission. |
internal/cmd/optimize_config.go |
Validates and forwards concurrency. |
internal/cmd/optimize_config_test.go |
Tests validation and request mapping. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 3
- Review effort level: Balanced
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
|
|
||
| if c.Options.MaxConcurrentAgentRuns != nil && *c.Options.MaxConcurrentAgentRuns < 1 { | ||
| return fmt.Errorf( | ||
| "options.max_concurrent_agent_runs must be >= 1 (got %d): set 'max_concurrent_agent_runs' under 'options:' in your config file", |
| n := 8 | ||
| cfg := &OptimizeConfig{ | ||
| Config: opt_eval.Config{ | ||
| Agent: opt_eval.AgentRef{Name: "agent"}, | ||
| Evaluators: opt_eval.EvaluatorList{{Name: "builtin.task_adherence"}}, | ||
| DatasetFile: writeTestFile(t, dir, "ds.jsonl", `{"query":"hi"}`), | ||
| }, | ||
| Options: &opt_eval.Options{ | ||
| EvalModel: "gpt-4o-mini", | ||
| OptimizationModel: "gpt-5", | ||
| MaxConcurrentAgentRuns: &n, |
| MaxStalls *int `json:"max_stalls,omitempty"` | ||
| // MaxConcurrentAgentRuns is the maximum number of agent invocations the | ||
| // evaluation service executes concurrently. Omitted when nil (service default applies). | ||
| MaxConcurrentAgentRuns *int `json:"max_concurrent_agent_runs,omitempty"` |
|
Hi @Ilya Matiach (@imatiach-msft). Thank you for your interest in helping to improve the Azure Developer CLI experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days. |
Problem
Evaluating large datasets sequentially takes O(n x t) time and frequently hits the 6-hour FAOS job timeout. The evaluation service already supports parallel agent invocations via the item_generation_params.max_concurrency field on the azure_ai_target_completions data source, but there was no way to set this from the optimize YAML config.
Without this, a 300-row evaluation with ~30s/row takes ~150 minutes sequentially, exceeding the timeout. With max_concurrent_agent_runs: 8 it should take ~19 minutes.
Change
Mirrors the pattern introduced for max_stalls in #9314. YAML-only, no CLI flag.
Changes:
Usage
options:
eval_model: gpt-4.1
optimization_model: gpt-5
max_concurrent_agent_runs: 8
Tests
8 new tests: YAML parsing (present/absent), Validate rejection of 0, Validate acceptance of positive values, ToRequest forwarding, ToRequest nil when omitted.