Skip to main content
POST
/
sessions
/
{session_id}
/
interrupt
Interrupt a running or HITL-parked chat run for a session
curl --request POST \
  --url https://api.example.com/sessions/{session_id}/interrupt \
  --header 'x-user-id: <x-user-id>'
{
  "session_id": "<string>"
}

Headers

x-user-id
string
required

Caller's user ID. Temporary header-based identity; will be replaced by JWT auth.

Path Parameters

session_id
string
required

Query Parameters

agent_id
string
required

Agent the session belongs to.

Response

Successful Response

Response body for POST /sessions/{sid}/interrupt (HTTP 202).

The interrupt operation is idempotent and always succeeds for an existing session (only 404 is raised when the session id does not exist):

  • If the session is running, an interrupt signal is published so the local :class:~agentscope.app._manager.CancelDispatcher cancels the chat-run task; the agent then runs its CancelledError cleanup path.
  • If the session is parked on HITL / external execution, a resume trigger carrying a :class:~agentscope.event.UserInterruptEvent is enqueued so the agent short-circuits into the same cleanup path.
  • If the session is idle, the call is a no-op.
session_id
string
required

Echo of the interrupted session id.