Hard stop a session immediately
Stops the session immediately, and with it everything downstream of it: every delegated session and sub-agent it started that is still working or waiting (independent ones included), and the compute they run on. An independent sub-agent that has already reported reads completed and is left as it is, along with anything still running under it; cancel that sub-agent by id to stop what runs under it. The cancel stops the running on-demand compute sandboxes it reaches and releases its own sandbox’s compute while it runs, and schedules a durable stop of anything else: a machine still provisioning within moments, and one whose stop failed within minutes. The response confirms the session stopped; sandbox cleanup may continue asynchronously and is retried; stopped workspaces are kept until retention ends. An active Evaluation or one with unfinished clone cleanup returns retryable 409 evaluation_cancellation_pending before the session is stopped; retry after Evaluation cleanup finishes. A session that already reached a terminal status with no pending cleanup keeps that status and gets the same response, so the call is safe to repeat, but its live delegated sessions and sub-agents are still stopped, and so are its own running on-demand compute sandboxes, which keep their workspaces as at the session’s end (a session already cancelled stops them, as its first cancel would have). The machines a live delegated session or sub-agent started are stopped with it, as in any cancel, and the session’s own sandbox is left as it is. A subagent still working is cancelled. One that closes with its requester and reported and waits to be messaged again stays completed but is stopped: the parent’s next send_to_agent to it reports that it cannot be reached, and only a direct message starts it again. Cancelling such a subagent directly stops it the same way.
Authorizations
Headers
Path Parameters
Response
Response body of POST /managed-agents/v1/sessions/{sessionId}/cancel. Cancel is terminal for the run but not for the record: the session and the sandbox it owns are stopped, while the session, its events, and its outcomes remain readable. The session row itself is removed from reads only by the separate soft-delete endpoint.
Response body of POST /managed-agents/v1/sessions/{sessionId}/cancel. Cancel is terminal for the run but not for the record: the session and the sandbox it owns are stopped, while the session, its events, and its outcomes remain readable. The session row itself is removed from reads only by the separate soft-delete endpoint.