Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/opencode/src/session/llm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export namespace LLM {
},
{
temperature: input.model.capabilities.temperature
? (input.agent.temperature ?? ProviderTransform.temperature(input.model))
? (input.user.temperature ?? input.agent.temperature ?? ProviderTransform.temperature(input.model))
: undefined,
topP: input.agent.topP ?? ProviderTransform.topP(input.model),
topK: ProviderTransform.topK(input.model),
Expand Down
1 change: 1 addition & 0 deletions packages/opencode/src/session/message-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ export namespace MessageV2 {
system: z.string().optional(),
tools: z.record(z.string(), z.boolean()).optional(),
variant: z.string().optional(),
temperature: z.number().min(0).max(2).optional(),
}).meta({
ref: "UserMessage",
})
Expand Down
2 changes: 2 additions & 0 deletions packages/opencode/src/session/prompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export namespace SessionPrompt {
format: MessageV2.Format.optional(),
system: z.string().optional(),
variant: z.string().optional(),
temperature: z.number().min(0).max(2).optional(),
parts: z.array(
z.discriminatedUnion("type", [
MessageV2.TextPart.omit({
Expand Down Expand Up @@ -1017,6 +1018,7 @@ export namespace SessionPrompt {
system: input.system,
format: input.format,
variant,
temperature: input.temperature,
}
using _ = defer(() => InstructionPrompt.clear(info.id))

Expand Down
7 changes: 7 additions & 0 deletions packages/opencode/src/tool/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ const parameters = z.object({
)
.optional(),
command: z.string().describe("The command that triggered this task").optional(),
temperature: z
.number()
.min(0)
.max(2)
.describe("Override the agent's temperature for this task (0.0 to 2.0)")
.optional(),
})

export const TaskTool = Tool.define("task", async (ctx) => {
Expand Down Expand Up @@ -142,6 +148,7 @@ export const TaskTool = Tool.define("task", async (ctx) => {
...Object.fromEntries((config.experimental?.primary_tools ?? []).map((t) => [t, false])),
},
parts: promptParts,
temperature: params.temperature,
})

const text = result.parts.findLast((x) => x.type === "text")?.text ?? ""
Expand Down
1 change: 1 addition & 0 deletions packages/opencode/src/tool/task.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Usage notes:
4. The agent's outputs should generally be trusted
5. Clearly tell the agent whether you expect it to write code or just to do research (search, file reads, web fetches, etc.), since it is not aware of the user's intent. Tell it how to verify its work if possible (e.g., relevant test commands).
6. If the agent description mentions that it should be used proactively, then you should try your best to use it without the user having to ask for it first. Use your judgement.
7. You can optionally override the agent's temperature setting by providing a temperature parameter (0.0 to 2.0). Lower values (e.g., 0.2) make the output more deterministic and focused, while higher values (e.g., 0.8) make it more creative and varied. Use this when you need fine-grained control over the subagent's behavior for specific tasks.

Example usage (NOTE: The agents below are fictional examples for illustration only - use the actual agents listed above):

Expand Down
Loading