POST /api/sessions/{session_id}/turns returns a text/event-stream response. Each frame sets the SSE event field to the event type and carries a JSON data payload with a matching type. The stream ends with a raw [DONE] frame.
Payload fields use camelCase on the wire. The source of truth is src/fleet_rlm/api/ui_stream.py, and openapi.yaml publishes it as FleetUIMessageChunk.
Stream order
- The stream opens with
turn_status (phase: "preparation") and repeats it every runtime.heartbeat_seconds until Fleet claims and prepares the Turn.
turn_start marks the start of execution.
- Step, reasoning, code, output, tool, and text events stream while the RLM works.
- The stream ends with exactly one terminal event:
turn_finish, turn_error, or turn_cancelled.
If claim or preparation fails, the stream emits turn_error and then turn_finish.
Lifecycle events
Content events
Activity events
Compatibility chunks
The stream contract also admits Vercel AI SDK UI message chunk shapes, such as start, text-delta, tool-input-available, finish, and data-* parts. The response sets the x-vercel-ai-ui-message-stream header. New clients should consume the event types above.
Example
Last modified on October 9, 2026