feat(delegate_tool): per-task model/provider override#43134
Conversation
Add optional model and provider fields to individual tasks in delegate_tool batch mode. Fallback chain: per-task field > delegation config > parent model. Closes NousResearch#18591
Multi-Provider Code Review — PR #43134PR: feat(delegate_tool): per-task model/provider override Verdict: APPROVED WITH WARNINGSThe implementation is well-structured, backward-compatible, and follows existing codebase patterns. All 8 reviewers converge on the same core assessment: the feature is sound but has a confirmed bug and several design-level concerns that warrant attention. No security blockers. One correctness bug (stale reference) and one design concern (batch abort semantics) should be addressed before or shortly after merge. Consensus Items (all 8 reviewers agree)
Warnings (majority flag)
Discordances (reviewers disagree)
Action Items (prioritized)
Positive Observations
Reviewer Scorecard
Consolidated by GLM-5.1 (ZAI provider) from 8 independent reviews on 2026-06-09. |
Review Feedback AddressedThanks for the thorough multi-provider review! All actionable items have been fixed in PR #43185:
16/16 tests passing. Supersedes this PR. Follow-up items (not included, can be addressed post-merge):
|
|
+1 This feature will help enable cost-effective multi-agent workflows by allowing task-appropriate model selection. Hope to see this land soon. |
|
Closing in favor of #43185 which includes the original feature plus all review fixes (stale |
Summary
Allows each task in a
delegate_taskbatch to override the model and/or provider independently. Addresses issue #18591.Problem
When delegating multiple tasks via
delegate_task, all children share the same model/provider resolved from the top-leveldelegationconfig. There is no way to route individual tasks to different providers — for example, sending research tasks to a fast/cheap model while keeping code review on a stronger one.Solution
Add two optional fields to each task item:
modelstringgemini-2.5-flash). Falls back to delegation config, then parent.providerstringgroq,openrouter). Triggers independent credential resolution.Fallback chain
If neither field is specified, behavior is identical to before — fully backward compatible.
Implementation
_resolve_task_credentials(new helper):_resolve_delegation_credentials.Dispatch loop change: before
_build_child_agent, checks for per-task fields and resolves credentials when present. Falls through to delegation credentials otherwise.Files changed
tools/delegate_tool.pymodel/providerproperties on task items. Dispatch: per-task credential resolution. New_resolve_task_credentialshelper.tests/tools/test_delegate_task_model_override.pyTests
test_delegate.pyExample
{ "tasks": [ { "goal": "Research topic X", "model": "gemini-2.5-flash", "provider": "google" }, { "goal": "Write summary", "model": "glm-5-turbo" }, { "goal": "Review code" } ] }Task 1 routes to Google Gemini. Task 2 overrides the model but keeps the current provider. Task 3 inherits everything as usual.
Closes #18591