feat(agent): implement model tier selection with variant support for subagents#11377
Conversation
|
The following comment was made by an LLM, it may be inaccurate: Potentially Related PRs Found:
These are historical variants/subagent work rather than current duplicates. The current PR (11377) appears to be the primary implementation for model tier selection. |
|
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? Which would enable per project provider locks but still allow transferability of agents across projects? |
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_tierparameter to Task tool withquick/standard/advancedvalues. You can configure tier-to-model mappings globally or per-agent, with agent-level overriding global when defined.Resolution hierarchy:
I also added optional
variantsupport 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.jsonwithmodel_tiersfor build and plan agents with different variants. Called Task with differentmodel_tiervalues daily and verified correct models were used. Confirmed agent tiers override global tiers as expected.