feat(delegation): add per-task model override for delegate_task - #41826
feat(delegation): add per-task model override for delegate_task#41826liuhao1024 wants to merge 1 commit into
Conversation
Add an optional `model` parameter to `delegate_task` that allows
routing different subagents to different model tiers. Supports both
top-level (applies to all children) and per-task (overrides for
individual tasks in batch mode) overrides.
Precedence: per-task model > top-level model > delegation.* config.
The `model` parameter follows the same pattern as cron job model
overrides — a dict with optional `provider` and `model` keys. When
only `model` is set, the child inherits the parent's provider
credentials (common case: use a cheaper model on the same provider).
When `provider` is also set, full credentials are resolved via the
runtime provider system.
Usage examples:
delegate_task(goal='...', model={'model': 'deepseek/deepseek-chat'})
delegate_task(tasks=[{'goal': '...', 'model': {'provider': 'anthropic', 'model': 'claude-sonnet-4'}}])
Fixes NousResearch#41814
|
+1 for this feature. Per-task model/provider override would be very useful for routing different subtasks to different cost/quality tiers. Looking forward to seeing this merged. |
…earch#41826) - Adds _resolve_model_override() for resolving per-task/top-level model config - Adds 'model' parameter to delegate_task (both top-level and per-task) - Supports model-only override (inherits parent provider) - Supports full provider override (resolves via runtime provider) - Adds 'model' field to delegate_task schema fix(tools): use \r on Windows PTY submit_stdin (NousResearch#31697 follow-up) - submit_stdin now sends \r on Windows (Enter key), \n on POSIX - write_stdin already handles bytes/str conversion per platform
|
For the love of God, PLEASE implement this feature! |
|
+1 Please implement it. It will be great! |
|
+1 Please implement! would be really useful! |
|
Strong +1 for this PR. Per-task/per-call model overrides are a useful foundation for routing delegated work across cost/quality tiers. I opened #46981 as a small dependent/additive follow-up that builds on this shape and adds explicit fallback isolation for cost-capped subagents e.g. allowing a cheap child model to avoid silently inheriting an expensive parent fallback chain. If #41826 lands first, #46981 can be rebased down to just the fallback-isolation delta. |
|
|
We do not want this |
Problem
delegate_taskcurrently uses a single global model configured viadelegation.model/delegation.providerinconfig.yaml. All delegated subagents run on the same model regardless of task complexity.This limits a common pattern: using different model tiers for different subtasks — e.g. a smart/expensive model for hard reasoning tasks, a cheap/fast model for mechanical work, and a medium-tier model as the default.
Solution
Add an optional
modelparameter todelegate_taskthat overrides the globaldelegation.*config for that specific invocation. Supports both top-level (applies to all children) and per-task (individual tasks in batch mode) overrides.Precedence: per-task model > top-level model > delegation.* config
API
Implementation
_resolve_model_override()— resolves a model dict into a credential dict (provider, base_url, api_key, api_mode), following the same pattern as cron job model overridesmodelis specified (noprovider), the child inherits the parent's provider credentials — the common "use a cheaper model" patternprovideris specified, full credentials are resolved via the runtime provider system"custom"provider is treated as no provider (inherits parent) — prevents LLM hallucinated custom providers from breaking resolutionChanges
tools/delegate_tool.py: +122 lines (new_resolve_model_overridehelper, schema additions, handler update)tests/tools/test_delegate.py: +207 lines (12 new tests covering schema validation, credential resolution, precedence ordering)Tests
Fixes #41814