v1
latestOpenAPI 3.1.02026-07-267154122.0 KBCancel the agent's currently-active run (idempotent, cooperative)
The per-agent mutex guarantees at most one in-flight run per agent, so cancel takes only the agentId. Wraps the same machinery the UI's stop route uses (markCancelling + Redis cancelStream publish).
Idempotent: returns 200 whether the agent has an active run, is already cancelling, or has no in-flight run at all. The response body always carries the latest run object — the just-cancelled one if there was one, otherwise the agent's most recent terminal run.
Headers
Transport-level replay protection — any v2 POST may send it (1–255 printable ASCII characters; UUIDs recommended). The first response for a key is recorded and replayed verbatim for retries with the same key + method/path/body for 24 hours; replayed responses carry the Idempotency-Replay: true response header. Reusing a key with a different request — or retrying while the original is still in flight — returns 409 IDEMPOTENCY_ERROR. 5xx responses are never recorded (the retry re-executes).
Response
The (possibly updated) run object, or { "run": null } when the agent has never had a run.
Example response
{
"run": {
"todo": {
"pendingQuestions": [
{
"freeformOption": "Or something else"
}
]
}
}
}