Cancel Agent Run
Cancellation and session identity
Use the run and session IDs returned by Create Agent Run:
curl --fail-with-body -X POST \
"http://127.0.0.1:7777/agents/reference-agent/runs/$RUN_ID/cancel?session_id=$SESSION_ID" \
-H "Authorization: Bearer $OS_SECURITY_KEY"For scoped callers, session_id is required and the stored run must belong to both the caller and the path agent. JWT users are scoped when user isolation is enabled; non-admin service-account PAT users are scoped even without that setting.
A 200 response with {} acknowledges cancellation intent. It can also acknowledge cancellation before execution starts. Poll Get Agent Run with the same session ID to check the run's stored status; the acknowledgement itself does not establish that execution has stopped.
/agents/{agent_id}/runs/{run_id}/cancelCancel a currently executing agent run. This will attempt to stop the agent's execution gracefully.
Note: Cancellation may not be immediate for all operations.
Authorization
HTTPBearer In: header
Path Parameters
Query Parameters
Session ID the run belongs to. Required for non-admin JWT users.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl --request POST 'https://example.com/agents/string/runs/string/cancel'null{ "detail": "string", "error_id": "string", "error_type": "string"}{ "detail": "string", "error_id": "string", "error_type": "string"}{ "detail": "string", "error_id": "string", "error_type": "string"}{ "detail": "string"}{ "detail": "string", "error_id": "string", "error_type": "string"}