Documentation Index
Fetch the complete documentation index at: https://mintlify.com/everruns/everruns/llms.txt
Use this file to discover all available pages before exploring further.
POST /v1/sessions//cancel
Cancels the currently executing turn in a session. This stops the workflow execution and emits appropriate events.Path Parameters
The ID of the session to cancel. Must be a valid session ID with the
session_ prefix.Request Body
No request body required.Response
Returns200 OK on success.
Error Responses
400 Bad Request- Session is not currently active (no turn to cancel)404 Not Found- Session does not exist or is not accessible401 Unauthorized- Missing or invalid authentication
Events Emitted
When a turn is successfully cancelled, the following events are emitted in order:turn.cancelled- Emitted immediately when cancel is requestedinput.message- User message: “User requested to cancel the work.”output.message.completed- Agent message: “Work was cancelled by user.” (emitted by worker when it stops)session.idled- Emitted when the session transitions to idle (emitted by worker)
session.idled events are emitted by the worker after it detects the cancellation and stops execution. This ensures the agent message appears after any in-flight events.
Example
Use Cases
- Stop a long-running task that’s no longer needed
- Interrupt an agent that’s stuck or taking too long
- Cancel execution before it completes naturally
Notes
- This endpoint only works when the session status is
active - Calling cancel on an
idlesession returns400 Bad Request - The cancellation is graceful: in-flight events are processed before stopping
- After cancellation, the session returns to
idlestatus and can accept new messages