-
Notifications
You must be signed in to change notification settings - Fork 5k
Add default variant config per agent #7140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
|
/oc I think this requires changes in tui too? |
|
Now I have a full picture. Here's my analysis: Does this PR require TUI changes? Short answer: No, the TUI doesn't need changes for the basic functionality to work, but there could be a UX enhancement. Here's why:
Conclusion: The TUI doesn't strictly require changes. The agent's default variant will be used correctly by the backend even without TUI changes. However, if you wanted to show the agent's default variant in the UI (as a visual indicator), that would be an optional UX enhancement, not a requirement. |
|
Good implementation! I noticed one potential gap: Missing
|
|
I've also opened PR #7156 with an alternative implementation that includes:
Both PRs are viable - this one is simpler (9 files), #7156 is more complete (14 files with desktop + message metadata). Happy to defer to maintainer preference on which to merge! |
|
Quick chime in, if this is the wrong place for the discussion then direct me to where I should. Does this also allow an Currently my only work-around is duplicating agents and setting a fixed model there. |

All changes are in place. Let me create a summary of the implementation:
Summary
I've implemented the default variant configuration per agent feature as specified in the issue. Here are the changes made:
Files Modified
packages/opencode/src/config/config.ts(lines 481, 497):variantfield toConfig.Agentschema with descriptionvarianttoknownKeysset for proper parsingpackages/opencode/src/agent/agent.ts(lines 37, 194):variantfield toAgent.Infotypevariantfrom config during agent state initializationpackages/opencode/src/session/llm.ts(lines 86-87):input.user.variant ?? input.agent.variantas the variant keypackages/opencode/src/tool/task.ts(line 135):agent.variantto subagent sessions so they use their own configured variantUsage
Users can now configure a default variant for each agent:
{ "agent": { "build": { "model": "anthropic/claude-sonnet-4-5-thinking", "variant": "high" }, "explore": { "model": "google/gemini-3-flash", "variant": "low" } } }Variant Priority Order
--variantflag orctrl+t)agent.variant)Subagent Behavior
Subagents now use their own configured
agent.variantrather than inheriting the parent's--variantoverride, respecting explicit per-agent configuration.Closes #7138
opencode session | github run