Skip to content

Feature: Per-task model override for delegate_task subagents #18591

@maxxqf-ai

Description

@maxxqf-ai

Problem

Currently delegation.model in config.yaml sets a single global model for ALL subagents spawned via delegate_task. There is no way to assign different models to different tasks based on complexity.

This becomes a real issue when using providers with strict rate limits (e.g. Zhipu GLM Coding Plan, where GLM-5.1 has very low concurrency and triggers 429 frequently). Users want to:

  • Use the strongest model (e.g. GLM-5.1) for the main agent / complex reasoning
  • Use a mid-tier model (e.g. GLM-5) for moderately complex subagent tasks
  • Use a fast/cheap model (e.g. GLM-5-turbo) for simple tasks like search, classification, summarization

Currently the only workaround is to change delegation.model globally before each delegation, which is impractical.

Proposed Solution

Add an optional model field to each task in the delegate_task tasks array:

{
  "tasks": [
    {
      "goal": "Analyze the codebase architecture",
      "model": "glm-5.1"
    },
    {
      "goal": "Search for relevant documentation",
      "model": "glm-5-turbo"
    },
    {
      "goal": "Write unit tests for the parser module",
      "model": "glm-5"
    }
  ]
}

Fallback chain:

  1. Per-task model field (highest priority)
  2. delegation.model from config.yaml
  3. Inherit parent agent model (current default)

Implementation notes

  • The _build_child_agent() function in tools/delegate_tool.py already resolves credentials via _resolve_delegation_credentials() — the per-task model would just override effective_model at that point
  • This is a non-breaking change: if no per-task model is specified, behavior stays exactly the same
  • Could also support provider at the per-task level for maximum flexibility, but model alone solves the common case

Use Case

Users on rate-limited Coding Plans (Zhipu, etc.) can conserve their expensive model quota by only using GLM-5.1 for tasks that truly need it, while dispatching simpler work to GLM-5-turbo or GLM-4.5-air. This avoids 429 errors and makes the Coding Plan quota last longer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/agentCore agent loop, run_agent.py, prompt buildertool/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