Summary
Allow the parent agent to specify model, provider, and optionally base_url on each delegate_task call (and per-task in batch mode), so it can dynamically route subagents to different models based on task type.
Motivation
Currently, subagent model selection is static via delegation.model / delegation.provider in config.yaml. This means ALL subagents use the same model. In practice, different tasks benefit from different models:
- Code tasks → fast, code-tuned model (e.g. glm-5.1)
- Research/reasoning → slower but stronger reasoning model (e.g. glm-5)
- Main thread → default configured model (e.g. glm-5-turbo)
The cronjob tool already supports per-job model/provider/base_url overrides — delegate_task should too. The plumbing already exists in _resolve_delegation_credentials() and _build_child_agent() (which already accepts override_provider/override_base_url/override_api_key/override_api_mode). This is mostly wiring the tool schema → handler path.
Proposed API
Single task mode
{
"name": "delegate_task",
"arguments": {
"goal": "Implement the auth middleware",
"context": "...",
"model": "glm-5.1",
"provider": "zai"
}
}
Batch mode (per-task overrides)
{
"name": "delegate_task",
"arguments": {
"tasks": [
{
"goal": "Research competitors",
"model": "glm-5",
"provider": "zai"
},
{
"goal": "Write integration tests",
"model": "glm-5.1"
}
]
}
}
Fallback chain
per-call model/provider → config delegation.model/provider → inherit from parent
This preserves backward compatibility — if no per-call override is given, behavior is identical to today.
Implementation notes
_build_child_agent() already accepts model and override_provider — just needs to be wired from the tool arguments
- Need
_resolve_delegation_credentials() or a new helper to resolve a one-off provider string (reusing resolve_runtime_provider()) when passed per-call
- Schema changes to
DELEGATE_TASK_SCHEMA: add model (string) and provider (string) at top level, plus model/provider inside each batch task item
- Provider validation: resolve at delegation time, return clear error if provider has no API key
- Consider adding
base_url as well for direct endpoint overrides (already supported in config)
Related
Summary
Allow the parent agent to specify
model,provider, and optionallybase_urlon eachdelegate_taskcall (and per-task in batch mode), so it can dynamically route subagents to different models based on task type.Motivation
Currently, subagent model selection is static via
delegation.model/delegation.providerinconfig.yaml. This means ALL subagents use the same model. In practice, different tasks benefit from different models:The cronjob tool already supports per-job
model/provider/base_urloverrides —delegate_taskshould too. The plumbing already exists in_resolve_delegation_credentials()and_build_child_agent()(which already acceptsoverride_provider/override_base_url/override_api_key/override_api_mode). This is mostly wiring the tool schema → handler path.Proposed API
Single task mode
{ "name": "delegate_task", "arguments": { "goal": "Implement the auth middleware", "context": "...", "model": "glm-5.1", "provider": "zai" } }Batch mode (per-task overrides)
{ "name": "delegate_task", "arguments": { "tasks": [ { "goal": "Research competitors", "model": "glm-5", "provider": "zai" }, { "goal": "Write integration tests", "model": "glm-5.1" } ] } }Fallback chain
per-call model/provider→config delegation.model/provider→inherit from parentThis preserves backward compatibility — if no per-call override is given, behavior is identical to today.
Implementation notes
_build_child_agent()already acceptsmodelandoverride_provider— just needs to be wired from the tool arguments_resolve_delegation_credentials()or a new helper to resolve a one-offproviderstring (reusingresolve_runtime_provider()) when passed per-callDELEGATE_TASK_SCHEMA: addmodel(string) andprovider(string) at top level, plusmodel/providerinside each batch task itembase_urlas well for direct endpoint overrides (already supported in config)Related
delegation.model,delegation.provider,delegation.base_urlmodel,provider,base_url— this feature would bring parity