Skip to content

feat(delegate): add per-task model override to delegate_task#6771

Open
GusBot69 wants to merge 1 commit into
NousResearch:mainfrom
GusBot69:feat/delegate-per-task-model-override
Open

feat(delegate): add per-task model override to delegate_task#6771
GusBot69 wants to merge 1 commit into
NousResearch:mainfrom
GusBot69:feat/delegate-per-task-model-override

Conversation

@GusBot69

@GusBot69 GusBot69 commented Apr 9, 2026

Copy link
Copy Markdown

Summary

Expose the existing per-child model override capability in the delegate_task tool schema. The internal _build_child_agent already accepts a model parameter (line 279: effective_model = model or parent_agent.model), but the tool schema doesn't expose it — making it impossible for the LLM to route different tasks to different models.

Problem

Currently, all subagents inherit the parent's model (or the global delegation.model config). There's no way to say "use a coding model for this task but a generalist for that task" within a single conversation.

The infrastructure exists but isn't wired to the tool schema.

Solution

3 changes in tools/delegate_tool.py:

  1. Schema: Add model field to top-level tool properties
  2. Batch schema: Add model field to per-task items
  3. Wiring: Thread t.get("model") through to _build_child_agent with fallback to delegation config

Task-level model takes precedence over delegation config, which takes precedence over parent model.

Usage

# Route coding task to coding specialist
delegate_task(
    goal="Debug this function",
    model="modelstudio/qwen3-coder-plus",
    context="..."
)

# Batch with different models per task
delegate_task(
    tasks=[
        {"goal": "Write unit tests", "model": "modelstudio/qwen3-coder-plus"},
        {"goal": "Review docs", "model": "modelstudio/qwen3.5-plus"},
    ]
)

Backwards Compatible

  • model is optional — defaults to parent behavior when omitted
  • No config migration needed
  • Existing delegation behavior unchanged when model is not specified
  • All 64 existing delegate tests pass

Related Issues

@HughesCuit HughesCuit 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.

LGTM

Expose the existing per-child model override capability in the
delegate_task tool schema. The internal _build_child_agent already
accepts a model parameter, but the tool schema doesn't expose it.

Changes:
- Add 'model' field to top-level tool schema properties
- Add 'model' field to per-task items in batch mode
- Thread model through to _build_child_agent via task dict
- Task-level model takes precedence over delegation config

Enables routing different tasks to different models:
  delegate_task(goal='debug this', model='modelstudio/qwen3-coder-plus')
  delegate_task(tasks=[{'goal': 'code', 'model': 'codex'}, {'goal': 'research', 'model': 'professor'}])

Fully backwards compatible — model is optional, defaults to parent behavior.

Related: NousResearch#5997, NousResearch#492, NousResearch#356
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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