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

Open
opened 2026-02-16 18:18:35 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/11377

State: open
Merged: No


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.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11377 **State:** open **Merged:** No --- ### What does this PR do? Closes [#6651](https://github.com/anomalyco/opencode/issues/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](https://github.com/anomalyco/opencode/issues/6651#issuecomment-3756543285)), allowing models to use different reasoning modes. See [#6651](https://github.com/anomalyco/opencode/issues/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.
yindo added the pull-request label 2026-02-16 18:18:35 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13761