Skip to content

feat(delegation): add model override to delegate_task (fixes #44900) - #44906

Closed
Morad37 wants to merge 2 commits into
NousResearch:mainfrom
Morad37:feat/delegate-model-override-44900
Closed

feat(delegation): add model override to delegate_task (fixes #44900)#44906
Morad37 wants to merge 2 commits into
NousResearch:mainfrom
Morad37:feat/delegate-model-override-44900

Conversation

@Morad37

@Morad37 Morad37 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Add an optional model parameter to delegate_task so subagents can run on a different model than the parent. Works like the existing model override in cronjob.

What changed

Function signature - delegate_task() now accepts model: Optional[Dict[str, str]] = None. Pass {provider: ..., model: ...} to override the model for all subagents.

Per-task override - Each task in the tasks array can also have its own model field, which beats the top-level override for that task only.

Resolution logic - Mirrors cronjob_tools._resolve_model_override. When you set model without provider, the current default provider is pinned at resolution time. This keeps the override stable even if you switch your default later.

Schema - Both the top-level and per-task model parameters are documented in the JSON schema as {type: object} with provider and model string properties.

Implementation details

  • Added _resolve_model_override_for_delegate() helper, mirrors the cronjob version
  • Top-level model is resolved after _resolve_delegation_credentials() and overrides the creds for all tasks
  • Per-task model is resolved per child in the build loop and passed as model + override_provider to _build_child_agent()
  • _build_child_agent() already accepted model and override_provider parameters, so no changes needed there

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/tools Tool registry, model_tools, toolsets tool/delegate Subagent delegation duplicate This issue or pull request already exists labels Jun 12, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #12715 — per-task/top-level model override for delegate_task. This is the earliest open PR in a saturated cluster (tracking #14974) of competing implementations (#17756, #41826, #31345). Consolidating there.

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Verdict: Approved

Clean feature addition. The model parameter on delegate_task allows callers to override the model used by subagents, with proper per-task precedence (per-task overrides beat top-level, which beat delegation config).

Looks Good

  • Implementation mirrors cronjob_tools._resolve_model_override for consistency
  • When only model is specified without provider, pins the current default provider so the override doesn't drift on config change
  • Schema properly documents the object structure with additionalProperties: False
  • Top-level parameter and per-task model field are both exposed in the schema
  • Clean error handling in _resolve_model_override_for_delegate with try/except

Reviewed by Hermes Agent

@Morad37

Morad37 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor Author

Agreed. #12715 covers this properly with the broader approach. Closing in favour of that. Thanks for the heads up @alt-glitch.

@Morad37 Morad37 closed this Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have tool/delegate Subagent delegation type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants