Agent Completion messages[]: system and user turns become one prompt

How Sume joins messages[] into one prompt, what a system turn can and cannot do, and why a GPT-6.1 Sol or Sonnet 5.5 chat history cannot be replayed as is.

5 min readSume
All posts

messages[] on an Agent Completion accepts only system and user turns, and Sume joins them in order into a single prompt for one run. It is not a chat transcript the agent resumes. If your GPT-6.1 Sol or Claude Sonnet 5.5 app keeps a history with assistant turns, flatten it into one user turn first, because an assistant turn answers 400 invalid_request. Send either messages or instruction, never both.

What the docs say

The Agent Completions page shows a request with a system turn ("Be terse.") and a user turn, and states that turns are joined, in order, into one prompt. content can be a string or an OpenAI-style array of text parts, and input_text is accepted as an alias. The "Not available yet" list names assistant turns in messages[] and continuing a prior thread with thread_id.

So the shape looks like Chat Completions on the way in, but the way out is not: the reply is a 202 agent.run receipt, with the result arriving later in output.

Where each piece belongs

Mapping an app's history onto one run (read 2026-10-04)
Your dataPut it inReason
Tone and house rulessystem turnJoined first, in order
The task for this runuser turnThis is the work
Prior model repliesSummarize inside the user turnassistant turns return 400
Records the agent should readinput objectWritten to a file and treated as data
Images to look atattachments[]Up to 30 images

A practical habit

Keep the system turn short and stable, and reserve the user turn for what changes per run. That makes two receipts comparable, and it keeps the part you tune separate from the part your application fills in.

When a user turn needs facts from earlier work, quote only the facts, for example the chosen product name and the approved caption, not the whole earlier conversation. The agent starts a fresh thread, so it will not remember anything you leave out.

  • Never send both instruction and messages.
  • Do not rely on role order beyond what the docs state: turns are joined in order.
  • Treat anything under input as data. Instructions placed there are not followed.
  • Remember the cap: generation_spend_cap_usd is required whichever form you use.

Related limits

There is no streaming and no synchronous choices[] response, so do not point an OpenAI-compatible client at this route and expect a chat completion back. If you need a structured final value, bind output_schema; the contract is on the Structured output page. Keys need the agent_completions:write scope, covered under Authentication.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume