You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit bf6215a
Browse filesBrowse the repository at this point in the historyBrowse files
feat(opencode): add model parameter to task tool for subagent model override
Adds an optional model parameter to the task tool that overrides which
model a subagent uses. Format: provider/model (e.g. anthropic/claude-sonnet-4).
Model priority: params.model > agent config > parent session model.
The model_override permission is denied by default, requiring users to
opt in via config (e.g. model_override: { anthropic/*: allow }).
This prevents prompt injection from escalating to expensive models.
Closesanomalyco#17595
description: Schema.String.annotate({description: "A short (3-5 words) description of the task"}),
22
23
prompt: Schema.String.annotate({description: "The task for the agent to perform"}),
23
24
subagent_type: Schema.String.annotate({description: "The type of specialized agent to use for this task"}),
25
+
model: Schema.optional(Schema.String).annotate({
26
+
description:
27
+
"Override the model for this subagent. Format: provider/model (e.g. anthropic/claude-sonnet-4, openai/gpt-4o). Takes precedence over the agent's configured model.",
"This should only be set if you mean to resume a previous task (you can pass a prior task_id and the task will continue the same subagent session as before instead of creating a fresh one)",
Copy file name to clipboardExpand all lines: packages/opencode/src/tool/task.txt
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,11 @@ When NOT to use the Task tool:
11
11
- If you are searching for code within a specific file or set of 2-3 files, use the Read tool instead of the Task tool, to find the match more quickly
12
12
- Other tasks that are not related to the agent descriptions above
13
13
14
+
Model selection:
15
+
- Each agent has a default model (usually inherited from the parent session).
16
+
- You can override the model by passing the `model` parameter in `provider/model` format (e.g. `anthropic/claude-sonnet-4`, `openai/gpt-4o`, `google/gemini-2.5-pro`).
17
+
- Model overrides require the `model_override` permission. By default this permission is denied and the user will be asked to approve. The user can allow specific models or providers in their config (e.g. `"model_override": { "anthropic/*": "allow" }`).
18
+
- Use the `model` parameter to run a subagent on a different model than the parent session. This is useful for leveraging different model strengths (e.g., sending research tasks to a faster/cheaper model, or routing code generation to a more capable model).
14
19
15
20
Usage notes:
16
21
1. Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses
0 commit comments