Skip to main content
Cancel the currently running execution for a session. Cancellation is cooperative — the agent checks for a cancel signal between steps and stops at the next checkpoint rather than being killed instantly.
string
required
The session ID whose execution should be cancelled
No request body is required.

Response

200 OK on success:

Error responses

object
Returned as {"error": "no_active_execution", "message": "No active execution found to cancel"} when the session has nothing running.
object
Returned when the session itself doesn’t exist (or isn’t owned by the authenticated user).

Cancelling a Human-in-the-Loop pause

A session suspended on an open Human-in-the-Loop approval card has no actively running worker task — the agent graph is parked on a checkpoint, waiting for hitl_response. Calling this endpoint while a session is in that state still succeeds: instead of stopping a live task, it abandons the pending approval. The backend finalizes the suspended checkpoint with a synthetic “cancelled by user” tool result and frees the session, so the next message is accepted instead of being rejected by the busy-guard that otherwise blocks new input while an approval is outstanding.
Abandoning a HITL pause this way does not “deny” the tool call through the normal approval flow — it ends the turn outright. If you want to formally deny a specific tool call and let the agent continue, respond to the approval card instead; see Human-in-the-Loop over WebSocket.

WebSocket equivalent

The WebSocket API exposes the same operation as a client message rather than an HTTP call — send a cancel_execution message on the socket instead of calling this endpoint:
Use whichever transport matches how you started the execution; both reach the same cancellation logic server-side.