@@ -62,6 +62,21 @@ function toCoreTool(
6262
6363 // ─── Main turn function ───────────────────────────────────────────────────────
6464
65+/**
66+ * Returns true when the model string refers to an OpenAI GPT model, which uses
67+ * the Responses API and honours the `instructions` provider option as the
68+ * authoritative system prompt (rather than a system-role message in `input`).
69+ */
70+function isOpenAIGPT(modelString: string): boolean {
71+ const slashIdx = modelString.indexOf("/");
72+ const provider =
73+ slashIdx === -1 ? modelString : modelString.slice(0, slashIdx);
74+ const modelId = slashIdx === -1 ? "" : modelString.slice(slashIdx + 1);
75+ return (
76+ (provider === "openai" || provider === "zen") && modelId.startsWith("gpt-")
77+ );
78+}
79+
6580 /**
6681 * Run a single agent turn against the model.
6782 *
@@ -70,12 +85,13 @@ function toCoreTool(
7085 */
7186 export async function* runTurn(options: {
7287 model: CoreModel;
88+ modelString: string;
7389 messages: CoreMessage[];
7490 tools: ToolDef[];
7591 systemPrompt?: string;
7692 signal?: AbortSignal;
7793 }): AsyncGenerator<TurnEvent> {
78- const { model, messages, tools, systemPrompt, signal } = options;
94+ const { model, modelString, messages, tools, systemPrompt, signal } = options;
7995
8096 // stepCount tracks completed steps (incremented in onStepFinish).
8197 // Used to detect the second-to-last step for the warning injection.
@@ -109,6 +125,21 @@ export async function* runTurn(options: {
109125 let contextTokens = 0;
110126
111127 try {
128+ // OpenAI GPT models use the Responses API (@ai-sdk/openai v3 / ai v6 default),
129+ // which honours `instructions` as the authoritative system prompt. Passing it
130+ // as a system-role message in `input` works but is treated as a lower-priority
131+ // user turn, causing the model to deprioritise the instructions.
132+ const useInstructions =
133+ systemPrompt !== undefined &&
134+ modelString !== undefined &&
135+ isOpenAIGPT(modelString);
136+
137+ // GPT models tend to describe planned tool calls without making them, then
138+ // yield back to the user. This applies broadly across the gpt-* family.
139+ // The one-liner closes that gap without adding opinion about how to do the task.
140+ const GPT_CONTINUATION =
141+ "\n\nAlways make tool calls rather than describing them. Keep going until the task is complete, then stop.";
142+
112143 const streamOpts: StreamTextOptions = {
113144 model,
114145 messages,
@@ -130,7 +161,17 @@ export async function* runTurn(options: {
130161 return undefined;
131162 },
132163
133- ...(systemPrompt ? { system: systemPrompt } : {}),
164+ ...(systemPrompt && !useInstructions ? { system: systemPrompt } : {}),
165+ ...(useInstructions
166+ ? {
167+ providerOptions: {
168+ openai: {
169+ instructions: systemPrompt + GPT_CONTINUATION,
170+ store: false,
171+ },
172+ },
173+ }
174+ : {}),
134175 ...(signal ? { abortSignal: signal } : {}),
135176 };