Skip to content

feat(agent): implement model tier selection with variant support for subagents#11377

Open
mcking-07 wants to merge 2 commits intoanomalyco:devfrom
mcking-07:feature/subagent-model-and-variant-selection-via-model-tiers
Open

feat(agent): implement model tier selection with variant support for subagents#11377
mcking-07 wants to merge 2 commits intoanomalyco:devfrom
mcking-07:feature/subagent-model-and-variant-selection-via-model-tiers

Conversation

@mcking-07
Copy link

What does this PR do?

Closes #6651

The issue is that subagents called via Task tool can't dynamically select models based on task complexity. Users end up creating duplicate agents (explore-quick, explore-standard, etc.) just to vary models, or waste money using powerful models for simple tasks.

I implemented the unified approach (Solution C) from the issue: added model_tier parameter to Task tool with quick/standard/advanced values. You can configure tier-to-model mappings globally or per-agent, with agent-level overriding global when defined.

Resolution hierarchy:

  1. Agent's explicit model (if set, tier ignored)
  2. Agent-level model_tiers[tier] - if defined
  3. Global model_tiers[tier] - if defined
  4. Parent session model (fallback)

I also added optional variant support to tier configurations (as noted in a later comment on the issue), allowing models to use different reasoning modes.

See #6651 for detailed implementation discussion and configuration examples.

How did you verify your code works?

Tests: Added comprehensive tests covering model tier resolution and variant extraction - 720 total pass, with 12 new tests for the feature (agent tier priority, global tier fallback, variant parsing, and resolution hierarchy).

Manual testing: Have been using this setup locally for about 2 weeks for development work. Configured opencode.json with model_tiers for build and plan agents with different variants. Called Task with different model_tier values daily and verified correct models were used. Confirmed agent tiers override global tiers as expected.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Potentially Related PRs Found:

  1. Add default variant config per agent (Add default variant config per agent #7140)

  2. feat: add variant support for subagents (feat: add variant support for subagents (#7138) [alt of #7140] #7156)

  3. feat: add variant support for commands (feat: add variant support for commands (#7713) #7907)

  4. feat(task): Add subagent-to-subagent delegation with budgets, persistent sessions, and hierarchical session navigation (feat(task): Add subagent-to-subagent delegation with budgets, persistent sessions, and hierarchical session navigation #7756)

These are historical variants/subagent work rather than current duplicates. The current PR (11377) appears to be the primary implementation for model tier selection.

@RicardoMonteiroSimoes
Copy link

If I understand this correctly, it just allows us to define levels for the same model, and allow references of it in agent definitions, right?
Something like a hierarchical selection of (depending on whats available) models isn't possible, as a simple example:

models: [opus, sonnet, gpt-5.3]

Which would enable per project provider locks but still allow transferability of agents across projects?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Dynamic model selection for subagents via Task tool

2 participants