Skip to content

Feature: Allow per-task model selection in delegate_task #6306

@davidvv

Description

@davidvv

Feature Request: Per-task model selection in delegate_task

Problem

Currently delegate_task does not expose a model parameter. Subagents always inherit the parent model or fall back to delegation.model from config. There is no way to select a different model per task at call time.

This is limiting for users who want tiered model routing — e.g. using a fast/cheap model (gemma4, 31B) for simple lookups and a powerful reasoning model (GLM-5.1, 128K context) for complex coding tasks.

Proposed Solution

Add an optional model parameter to delegate_task at three levels:

  1. Per-task level (in the tasks array items):
{
  "goal": "simple lookup",
  "model": "gemma4:31b-cloud"
}
  1. Top-level goal call (single task shorthand):
{
  "goal": "check Champions League scores",
  "model": "gemma4:31b-cloud"
}
  1. Config default (existing delegation.model in config.yaml):
    Remains as the fallback when no per-task model is specified.

Behavior

  • model is optional. If omitted, falls back to delegation.model from config, or the parent agent model.
  • The internal _build_child_agent function already supports model:
effective_model = model or parent_agent.model

This just needs to be wired through from the public delegate_task API.

  • The DELEGATE_TASK_SCHEMA also needs model added to the parameters.

Suggested Implementation Hints

  • Add model: Optional[str] = None to delegate_task() signature
  • Add model to DELEGATE_TASK_SCHEMA.properties
  • In the task loop, resolve effective_model = task.get("model") or model or delegation_default
  • Pass model=effective_model through to _build_child_agent()

Use Case Example

# Fast cheap subagent for a lookup
delegate_task(goal="Check tonight's Champions League scores", model="gemma4:31b-cloud")

# Powerful reasoning subagent for complex refactor
delegate_task(goal="Refactor the auth module across 12 files", model="glm-5.1:cloud")

# Default model (from delegation.config or parent)
delegate_task(goal="Something moderate")

Priority

Medium — enables better cost/performance tradeoffs for users with multi-model setups.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to haveduplicateThis issue or pull request already existstool/delegateSubagent delegationtype/featureNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions