Skip to content

Commit d8dc23b

Browse files
committed
pass through additional agent options to the provider
1 parent 1c83ef7 commit d8dc23b

3 files changed

Lines changed: 42 additions & 7 deletions

File tree

‎packages/opencode/src/agent/agent.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export namespace Agent {
1414
mode: z.union([z.literal("subagent"), z.literal("primary"), z.literal("all")]),
1515
topP: z.number().optional(),
1616
temperature: z.number().optional(),
17-
options: z.record(z.any()),
1817
model: z
1918
.object({
2019
modelID: z.string(),
@@ -23,6 +22,7 @@ export namespace Agent {
2322
.optional(),
2423
prompt: z.string().optional(),
2524
tools: z.record(z.boolean()),
25+
options: z.record(z.string(), z.any()),
2626
})
2727
.openapi({
2828
ref: "Agent",
@@ -73,6 +73,11 @@ export namespace Agent {
7373
options: {},
7474
tools: {},
7575
}
76+
const { model, prompt, tools, description, temperature, top_p, mode, ...extra } = value
77+
item.options = {
78+
...item.options,
79+
...extra,
80+
}
7681
if (value.model) item.model = Provider.parseModel(value.model)
7782
if (value.prompt) item.prompt = value.prompt
7883
if (value.tools)
@@ -84,11 +89,6 @@ export namespace Agent {
8489
if (value.temperature != undefined) item.temperature = value.temperature
8590
if (value.top_p != undefined) item.topP = value.top_p
8691
if (value.mode) item.mode = value.mode
87-
if (value.options)
88-
item.options = {
89-
...item.options,
90-
...value.options,
91-
}
9292
}
9393
return result
9494
})

‎packages/opencode/src/config/config.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ export namespace Config {
173173
tools: z.record(z.string(), z.boolean()).optional(),
174174
disable: z.boolean().optional(),
175175
description: z.string().optional().describe("Description of when to use the agent"),
176-
options: z.record(z.string(), z.any()).optional().describe("Additional model options passed through to provider"),
177176
mode: z.union([z.literal("subagent"), z.literal("primary"), z.literal("all")]).optional(),
178177
})
178+
.catchall(z.any())
179179
.openapi({
180180
ref: "AgentConfig",
181181
})

‎packages/web/src/content/docs/docs/agents.mdx‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,41 @@ The `mode` option can be set to `primary`, `subagent`, or `all`. If no `mode` is
360360

361361
---
362362

363+
### Additional options
364+
365+
Any other options you specify in your agent configuration will be passed through directly to the provider as model options. This allows you to use provider-specific features and parameters.
366+
367+
```json title="opencode.json"
368+
{
369+
"agent": {
370+
"reasoning": {
371+
"model": "openai/gpt-5-turbo",
372+
"reasoningEffort": "high",
373+
"textVerbosity": "medium"
374+
}
375+
}
376+
}
377+
```
378+
379+
For example, with OpenAI's reasoning models, you can control the reasoning effort:
380+
381+
```json title="opencode.json"
382+
{
383+
"agent": {
384+
"deep-thinker": {
385+
"description": "Agent that uses high reasoning effort for complex problems",
386+
"model": "openai/gpt-5-turbo",
387+
"reasoningEffort": "high",
388+
"textVerbosity": "low"
389+
}
390+
}
391+
}
392+
```
393+
394+
These additional options are model and provider-specific. Check your provider's documentation for available parameters.
395+
396+
---
397+
363398
## Create agents
364399

365400
You can create new agents using the following command:

0 commit comments

Comments
 (0)