Runs

Cancel the agent's currently-active run (idempotent, cooperative)

Changed on

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.

post/agents/{id}/cancel

Request

  • Base URL
    https://origami.chat/api/v2
  • URL
    https://origami.chat/api/v2/agents/{id}/cancel
  • Auth
    HTTP bearer

Headers

Idempotency-Keystring

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/workspaceId deprecated

    • info

      response property run/allOf[Run]/allOf[subschema #2]/workspaceId deprecated