Stop is served only when turn control is on for your environment. You can tell it is on in two ways: the conversation detail response carries the
turn key, or the conversation frame of a turn stream carries "turn_control": true. Until then the Stop and turn routes answer 404 not_found. Show Stop only after you have seen one of the two, and never call these routes before that.Terms
- A turn is one user message and the work the assistant does for it. You name it with the
turn_idyou send, and you read it from its turn stream. - A frame is one entry of the turn stream. Each carries a
seqthat only grows. - A turn is at rest when its status is
completed,stoppedorfailed. Nothing more happens to it. - A turn is stopping when Stop was pressed and the turn has not come to rest yet, for example because a write that already started is finishing. The platform does not store this status. It reads it from the stop and the turn’s state.
Show Stop
Show one button. It replaces Send while the assistant works, in the same place and at the same size.- Show Stop from the moment you send a message until the turn is at rest.
- Keep showing it while the turn runs your client tools. Stop works in every status that is not at rest. At a confirmation pause, show Send and the approval card instead.
- You know the
turn_idbefore you send, because you generate it. A Stop that arrives before the turn is admitted is kept: the turn stores the user message and rests as stopped with no model call. - On the click, note the
seqof the last frame your screen applied, stop drawing new content, and show the reply as stopped at once. Send thatseqassealed_through. - Show Send again once the turn is at rest.
Call Stop
POST /conversations/instances/{instance_slug}/conversations/{conversation_id}/turns/{turn_id}/stop
Credential: a scoped key with conversations:use. An organization API key is refused (why). The body carries the same end_user as the turn, and optionally sealed_through, the seq of the last frame your screen showed. The stored reply is exactly what was shown up to that frame, plus any write that had already started. Absent means everything the turn produced so far.
- On a turn that was not at rest,
statusisstoppinguntil the turn comes to rest, thenstopped. A turn already at rest is returned unchanged, whatever its status (completed,stoppedorfailed). sealed_throughis the stop’s cut point andsealed_seqis theseqof thesealframe on the stream.- Stop is safe to repeat. A repeat answers the first stop’s
sealed_throughandsealed_seq, so a lost answer can be retried. If another screen stopped the turn first at a different point, the first stop wins; read the stream again to show what it kept. - A Stop for a
turn_idthat is not admitted yet answers202with{"turn": {"id": "...", "admitted": false, "sealed": true}}. - Stop works on an archived conversation.
- A turn that started before turn control was on has no record. Stop on it answers
404 turn_not_found.
While the turn is stopping
- Keep showing the reply as stopped. Do not show Send yet.
-
Keep reading the stream if you have one open. It carries a
sealframe, anoutcomeframe for each write that was still running, and ends withturn_endandstop_reason: "stopped". Remove any content frame with aseqabovesealed_throughand belowsealed_seqthat you drew, except the step of a write that had started. -
Without an open stream, open it again with
afterset to the lastseqyou applied, or read the turn every two seconds until it is at rest:GET /conversations/instances/{instance_slug}/conversations/{conversation_id}/turns/{turn_id}?end_user=...It answers{"turn": {...}}in the same shape as Stop. The read changes nothing.
Read a stopped turn
The turn object
The transcript
- The text the screen showed up to
sealed_throughis kept as the reply’s text. Show it with a short “Stopped” line under it. - Every step that started gets a stored result. Show it as a stopped step. The result says what is known:
A step that finished before the stop keeps its real result.
- The model sees the same stored results on the next message, so it can tell the user what is known about each stopped step.
After a reload
Conversation detail carries two keys while turn control is on:turnis the latest turn of the version the conversation serves, ornullwhen that turn has no record. Use it to decide whether to show Stop or Send. While it is running, open its stream withafter=0to draw it again.turnslists every turn with a message in the returned transcript window that did not end normally, oldest first:[{"id": "...", "status": "stopped", "stop_reason": "stopped"}]. It is an empty list when there is none. Each message carries itsturn_id, so mark the last message of each listed turn as stopped.
What Stop does not do
- It does not undo a step that ran.
- It never cuts a write. A write that already started finishes, and its result is kept.
- It cancels only the runs the turn itself submitted. A run the turn only attached to, or one an earlier turn started, keeps going. Runs your own tools started are yours to cancel. See Client tools.
Edit a message while a turn runs
Send the edit withstop_active_turn: true, a new turn_id, and optionally sealed_through_active, the seq of the last frame your screen showed for the running turn:
- The platform stops the running turn, then admits the reply to the edited message as a new version, in the same request.
- The old version keeps its stopped work. The user can switch back to it.
- Without
stop_active_turn, an edit while a turn runs answers409 turn_in_progress. - If the running turn does not come to rest within 3 seconds, the request answers
409 turn_in_progress. The stop stays recorded. Send the edit again once the turn is at rest. - Disable Save while the request is in flight. A repeat with the same
turn_idanswers the same turn. - A version switch while the latest turn is not at rest answers
409 turn_active. Disable the version switcher while the assistant works.
Late results
Your executor may finish a client tool call after the turn stopped. Post its result as usual, to the call’s result route (see Client tools).- The platform keeps it: the answer is
202 {"recorded": "late"}. The result replaces the step’s stored placeholder once. No model call follows. The stream carries anoutcomeframe for the step. - A second post for the same step answers
202 {"recorded": "ignored"}. - Only a step that may have run takes a late result. A step stored as “It did not run” never does.
- A write the platform ran itself reports its late outcome the same way, on the stream.
Lost turns
The platform ends a turn nobody can finish, so a conversation never gets stuck. If the worker running a turn dies, for example in a crash, the platform ends the turn asfailed with stop_reason: "segment_lost". Its open steps get the “No result was recorded.” result. The next message is accepted. A deploy does not lose a turn: the worker finishes its current step and another worker continues the turn.
Errors
Turns and streaming
Frames, turn states, and stop reasons.
Stop a turn (API reference)
The generated endpoint contract.