Skip to main content

Stop the session's running work

POST 

/session/cancel

Stops the work of the session named by X-Session-ID without deleting anything. It cancels a message still waiting to start a turn, interrupts the running turn in the session's worker, pauses unfinished workflows, and cancels every child agent still running, including children of turns that already ended. It takes no request body.

Peen records the stop before it interrupts the worker, and the call returns without waiting for the work to wind down. A request accepted before the stop cannot start afterward, and reconnecting does not resume paused work. A foreground runCommand kills its process group; background jobs already handed back keep running.

It answers 202 whether or not anything was running, so repeating it is safe. Returns 404 SESSION_NOT_FOUND when the session does not exist.

Request​

Responses​

The stop was recorded. cancelRequested says whether anything was running to stop.

Response Headers
    X-Session-ID

    The session this response belongs to. For session-scoped requests it echoes the X-Session-ID request header; for POST /sessions/open and POST /sessions/system it is the session that was opened or created.

    X-Request-ID

    The request's correlation ID. When the request carried an X-Request-ID header holding a UUID, Peen echoes it; otherwise Peen generates a new UUID. The controller log records the same value for this request.