turn/start and observes progress through notifications. In Chat mode it is usually a provider call. In Agent mode it can include prompt compilation, tool calls, MCP calls, skills, task tools, subagents, retries, recovery, or a CLI-backed agent runtime.
Methods
Starting a turn
Response:
Execution backends
By default, a turn uses the thread’s provider/model selection or themodel_provider and model fields from turn/start. Clients can make the execution backend explicit:
cliAgentRuntime:
permission_profile is the Pioneer-level approval policy. The gateway maps it into the runtime-specific approval policy before starting the native runtime turn. cli_runtime_options is still runtime-specific for options such as sandbox, effort, personality, summary, or steering. A client should fetch runtime capabilities and model catalogs through the CLI Runtime API before offering a CLI runtime in a model selector.
When a CLI runtime turn is active, the runtime can open pending requests for command approvals, file-change approvals, or user input. Clients resolve those through cli_runtime/request/respond, not turn/start.
Permission profiles and approval requests
Pioneer tool permissions are represented bypermission_profile on turn/start and by the materialized permission_profile on every Turn.
The gateway stores a
TurnPermissionProfileSnapshot with:
ToolPermissionPolicySnapshot contains default_behavior, file_read, file_write, shell_command, network, mcp_read, mcp_write_or_unknown, dynamic_skill_tool, computer_use, task_subagent, and optional allowed_tools, denied_tools, and allowed_paths.
The gateway also resolves a TurnExecutionSecuritySnapshot for runtime enforcement. That snapshot includes:
Built-in mode mapping:
When a native Pioneer tool action requires approval, the gateway publishes:
An approval request includes
request_id, workspace_id, thread_id, turn_id, optional visible_thread_ids, tool_name, action, scope_hash, reason, optional summary, and display details.
Resolve it with:
allow_once, allow_for_turn, deny, cancelled, and expired. allow_for_turn lets later matching requests with the same normalized scope proceed during the same turn without opening another approval request.
CLI runtime-native approvals use the CLI runtime request API. Native Pioneer tool permissions use the turn permission API described here.
Generated permission schemas:
/schemas/turn_permission_mode.json/schemas/turn_permission_profile_selection.json/schemas/turn_permission_profile_snapshot.json/schemas/tool_permission_policy_snapshot.json/schemas/turn_execution_security_snapshot.json/schemas/turn_sandbox_snapshot.json/schemas/turn_sandbox_mode.json/schemas/turn_filesystem_sandbox_policy.json/schemas/turn_filesystem_sandbox_entry.json/schemas/turn_network_policy_snapshot.json/schemas/turn_process_policy_snapshot.json/schemas/turn_security_backend_snapshot.json/schemas/turn_security_enforcement_status.json/schemas/turn_security_degradation.json/schemas/turn_security_parent_cap_snapshot.json/schemas/permission_behavior.json/schemas/turn_permission_approval_request.json/schemas/turn_permission_approval_resolution.json/schemas/turn_permission_request_opened_notification.json/schemas/turn_permission_request_resolved_notification.json/schemas/turn_permission_request_respond_params.json/schemas/turn_permission_request_respond_response.json/schemas/turn_permission_audit_event.json
User input
UserInput is a tagged union. Common variants:
Files, artifacts, and remote gateways
localFile and localImage mean “a path visible to the gateway.” They are convenient for local developer flows, but they are not a portable client contract. If a desktop or mobile client is connected to a remote gateway, a path like /Users/alexander/Desktop/photo.jpg exists on the client machine, not on the gateway machine.
The remote-safe path is:
- Upload the file with the artifact upload API.
- Bind or attach the resulting artifact to the turn.
- Send a
UserInputartifact reference, for example{ "type": "artifact", "artifactId": "art_..." }.
artifact tool domain and call artifact_read if it needs the actual content.
This is why clients should treat artifacts as the durable file identity and local paths as a gateway-local convenience.
Turn capabilities
Skills and MCP selections are sent separately frominput:
label is optional display text for timeline chips.
The gateway normalizes duplicate and invalid capability input before resolution. Accepted capabilities are reported with reason explicit_composer_capability; rejected capabilities include reasons such as not_found, disabled_by_policy, validation_rejected, security_blocked, dependency_missing, catalog_missing, tool_missing, or provider_unsupported.
Composer-selected skills become compact skill prompt entries and optional skill dynamic tools. Composer-selected MCP servers and tools become dynamic provider tools; they do not add MCP prompt text.
Cancelling a turn
Turn. A cancelled turn is represented as an interrupted/failed terminal state depending on where cancellation lands in the runtime.
Resuming a blocked turn
When a turn is blocked by recovery policy or an exhausted execution window, clients can resume it withturn/resume:
recovery_job_id is optional. If omitted, the gateway chooses the active recovery job for the turn when one is available. The response includes the updated Turn and the recovery job id used for the resume operation.
Clients should expect a blocked turn to publish turn/blocked before user-visible recovery actions become available.
Reading items
turn/items returns persisted TurnItemEvent rows for one turn.
Semantic timeline and turn work
The current semantic timeline API is split by level:
Use Threads API
thread/timeline/page when rendering a scrollable conversation. Use turn/work/page when the user expands or paginates the detailed work for a single turn.
Turn work page
turn/work/page loads the paginated work items inside one semantic turn work block. It is the detail API paired with Threads API thread/timeline/page.
workspaceId, threadId, turnId, projectionVersion, sourceHighWatermark, projectionUpdatedAtUnixMicros, work, items, and page.
sourceHighWatermark and projectionUpdatedAtUnixMicros let clients reject an older response that arrives after a newer projection. Work items also carry source sequence and source-update timestamps. Use these values to prevent a late reconnect response from changing a completed, failed, or cancelled item back to an older state.
Fetching changed work items
turn/work/items/get is the narrow refresh path for semantic timeline reducers. Send the work item ids named by a change notification:
removedWorkItemIds, along with the projection freshness fields. A client can merge this response into the existing timeline without discarding unrelated loaded pages.
Use turn/work/page when expanding or paginating the work under a turn. Use turn/items for raw persisted event replay.
Generated turn-work schemas:
/schemas/turn_work_block.json/schemas/turn_work_item.json/schemas/turn_work_page_params.json/schemas/turn_work_page_response.json/schemas/turn_work_items_changed_notification.json/schemas/turn_work_state_changed_notification.json
Turn items
TurnItem is the timeline object that clients render. Main variants:
Tool items include
status, arguments, output_policy, display/storage payloads, optional recovery policy, optional recovery view, and normalized outcome fields.
Streaming notifications
Turn execution is observed through notifications:
Delta notifications include
stream: agent_message, stdout, stderr, tool_progress, file_change, or generic.
Execution windows
Long agent turns are divided into execution windows. A window bounds agent rounds, tool calls, wall-clock time, and provider-token accounting. When a window is exhausted, the gateway can checkpoint the turn and continue in a new window, or block the turn if the total turn budget has been reached. Execution window statuses serialize asrunning, exhausted, checkpointed, continued, completed, interrupted, blocked, or failed.
Exhaustion reasons serialize as:
Execution-window notifications are:
The per-window limits come from
[gateway.tools.execution_windows]; total turn limits come from [gateway.tools.execution_windows.total].
Recovery and retry notifications
The gateway also publishes detailed recovery events:
Clients can render these as timeline diagnostics or use them to trigger a timeline refresh.
Voice-created turns
Voice input is controlled by the Voice API, but successful voice sessions become normal turns. The gateway owns transcription and starts the final turn with the transcript as the firstUserInput::Text item. Clients should render the resulting user message, assistant work, permission prompts, and terminal state from the normal turn and timeline notifications.
Cancelled and no-speech voice sessions do not create a turn or a timeline user message. Voice platform microphone permission is client-side capture state; it is separate from Pioneer agent permission_profile and turn sandbox/resource policy.
Prompt manifest
When the prompt compiler runs, theTurn can receive a prompt_manifest: