Skip to main content
A Turn represents one round of conversation, typically starting with a user message and finishing with an agent message. Each turn contains multiple items that stream as notifications.

Turn Object

string
Unique turn identifier (e.g., turn_456)
ThreadItem[]
Array of items in this turn
Only populated on thread/resume or thread/fork responses. For all other responses and notifications, this field is an empty array. Use item/* notifications to track items.
TurnStatus
Current turn status
  • inProgress - Turn is actively running
  • completed - Turn finished successfully
  • interrupted - Turn was cancelled
  • failed - Turn encountered an error
TurnError | null
Error details (only populated when status is failed)

Start a Turn

Send user input to a thread and begin Codex generation.

Method

Parameters

string
required
Thread ID to add the turn to
UserInput[]
required
Array of user input items
string
Override working directory for this turn and subsequent turns
string
Override approval policy
SandboxPolicy
Override sandbox policy
string
Override model for this turn and subsequent turns
string
Override reasoning effort (low, medium, high)
string
Override reasoning summary mode (concise, verbose)
object
JSON Schema to constrain the final assistant message (applies only to this turn)

Response

Turn
Initial turn object with status: "inProgress" and empty items array

Notifications

The server streams JSON-RPC notifications while the turn is running:
1

turn/started

Initial turn notification
2

item/* notifications

See Items for full item lifecycle
  • item/started - New item begins
  • item/agentMessage/delta - Streamed text
  • item/completed - Item finishes
3

turn/completed

Final turn notification with status

Example: Basic Turn

Example: Invoke a Skill

Include $<skill-name> in the text input and add a skill input item.

Example: Invoke an App

Include $<app-slug> in text and add a mention input with app://<connector-id>.

Interrupt a Turn

Cancel a running turn.

Method

Parameters

string
required
Thread ID
string
required
Turn ID to interrupt

Response

object
Empty object on success

Notifications

After interruption, the server emits turn/completed with status: "interrupted".

Example

Steer a Turn

Append additional user input to a currently active turn without starting a new turn.

Method

Parameters

string
required
Thread ID
UserInput[]
required
Additional user input to append
string
required
Required active turn ID precondition. Fails if no active turn or ID doesn’t match.

Response

string
The active turn ID that accepted the input

Example

Turn Notifications

Emitted when a turn beginsPayload: { threadId: string, turn: Turn }
Emitted when a turn finishes (completed, interrupted, or failed)Payload: { threadId: string, turn: Turn }
Emitted after every fileChange item with turn-level unified diffPayload: { threadId: string, turnId: string, diff: string }
Emitted when the agent shares or changes its planPayload:
Emitted when the backend reroutes to a different modelPayload: { threadId: string, turnId: string, fromModel: string, toModel: string, reason: string }
Emitted on mid-turn errorsPayload: { error: TurnError, willRetry: boolean, threadId: string, turnId: string }

Next Steps

Items

Understand item types and streaming notifications

Models

List available models and their capabilities