feat(delegate): per-task model and provider overrides#23266
Open
alex-abell wants to merge 1 commit into
Open
Conversation
Allow each task in the 'tasks' batch array to specify its own model and provider, routing individual subtasks to different LLMs while the rest inherit the global delegation config. Problem: delegate_task applied a single global model (from delegation.model in config.yaml) to every child. There was no way to say 'run this hard reasoning task on Opus, everything else on Sonnet' without changing the global config. Solution: add optional model and provider fields to each task object in the tasks array. When present, _build_child_agent is called with a task-specific credential bundle resolved from a config overlay (global config + per-task overrides). When absent, the task falls back to the existing global creds — no behavior change for existing callers. Changes: - tools/delegate_tool.py: resolve per-task creds when task.model or task.provider is set; pass task_creds into _build_child_agent instead of the global creds for that task - tools/delegate_tool.py: add model and provider to DELEGATE_TASK_SCHEMA tasks[].items.properties with descriptive docstrings - tools/delegate_tool.py: add MODEL ROUTING section to tool description - tests/tools/test_delegate.py: TestPerTaskModelOverride (4 tests) Note: cron jobs already support per-job model/provider (cronjob_tools.py). This brings delegate_task to parity. Both use OpenRouter's model routing under the hood — provider='openrouter' + any model string works today.
Collaborator
This was referenced May 13, 2026
This was referenced May 24, 2026
This was referenced May 29, 2026
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.
Problem
delegate_taskapplies a single global model to every child agent (fromdelegation.modelin config.yaml). There's no way to route individual subtasks to different models without changing the global config between runs.Cron jobs already support per-job
model+provideroverrides. This PR bringsdelegate_taskto parity.Solution
Add optional
modelandproviderfields to each task object in thetasksbatch array. When present, that task's child agent is built with a task-specific credential bundle. When absent, the task inherits global delegation creds — no behavior change for existing callers.Changes
tools/delegate_tool.py: resolve per-task creds whentask.modelortask.provideris set; passtask_credsinto_build_child_agentfor that tasktools/delegate_tool.py: addmodelandprovidertoDELEGATE_TASK_SCHEMA tasks[].items.propertiestools/delegate_tool.py: add MODEL ROUTING section to tool descriptiontests/tools/test_delegate.py: 4 new tests inTestPerTaskModelOverrideTest plan
124 pass (same as before + 4 new). The 4 pre-existing failures in
TestDelegationCredentialResolutionandTestDelegateHeartbeatare unrelated to this change and reproduce onmain.