Agent

Stop the session's in-flight turn

The explicit Stop (kernel work model, D5). Cancels the running turn promptly: the stream emits the terminal turn-ended frame with reason cancelled, partial assistant text is committed to the transcript, and the session survives for the next turn — stopping a turn does not cost the conversation. Idempotent: cancelling when no turn is running is a 200 no-op, not a conflict. Disconnect inference backs this endpoint up: a turn whose SSE watchers all vanish is cancelled after a short grace window, while a turn that never had a watcher (fire-and-forget) runs to its budget.

post/v1/agent/turn/cancel

Request

  • Base URL: http://localhost:9998
  • URL: http://localhost:9998/v1/agent/turn/cancel
  • Auth: HTTP bearer

Request body

session_idstring required

The session whose turn to cancel

run_idstring

Optional. The run to stop; when it is not the running run, nothing is cancelled (200), so a Stop aimed at a finished run never stops the one after it.

Response

No turn was running, or run_id named a run that is not the running one (idempotent no-op)

oktrue
session_idstring
cancelledfalse

Changes

No recorded changes to this operation across all 1 revision of this API.