Cancel the agent's currently-active run (idempotent, cooperative)
Changed onThe 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.
Request
- Base URLhttps://origami.chat/api/v2
- URLhttps://origami.chat/api/v2/agents/{id}/cancel
- AuthHTTP bearer
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"
}
]
}
}
}Changes
- breaking
the response property
/////////////became nullable for the status - info
response property
run/allOf[Run]/allOf[subschema #2]/response/allOf[RunResponse]/tables/items/workspaceIddeprecated - info
response property
run/allOf[Run]/allOf[subschema #2]/workspaceIddeprecated
- breaking