Agents

Cancel an agent run

Changed on

Request cooperative cancellation of the durable agent run identified by run_id in the JSON body. Requires ownership, current agent access, and the agents.run scope. Sending a cancellation signal does not itself change an active run from RUNNING; poll GET run for the final state. Paused runs become CANCELLED without resuming execution. Repeated requests and requests for terminal runs return the current snapshot. Completion may win a race with cancellation. Completed tool side effects cannot be undone, and external work may continue if a tool does not support cancellation. Cancellation targets this run, not separate background-subagent executions. An active run without a cancellation registration returns 409. Cancellation signaling requires Redis. An interrupted active run can instead become FAILED through deadline cleanup; this does not verify that external tool work has stopped.

post/api/agents/{agent_id}/cancellations

Request

  • Base URL: https://instance-name-be.glean.com
  • URL: https://instance-name-be.glean.com/api/agents/{agent_id}/cancellations
  • Auth: HTTP bearer

Path parameters

agent_idstring required

ID of the agent that owns the run.

Request body

run_idstring required

ID of the run to cancel. Must belong to the agent identified in the path.

Example request

{
  "run_id": "{run_id}"
}

Response

Current run snapshot after requesting cancellation, or an unchanged terminal run.

request_idstring required

Platform-generated request ID for support correlation.

Changes