Skip to main content

Finish Autopilot Run

PATCH 

/api/support/agent/tickets/:ticket/ai/runs/:run

Records how an AI agent session ended. A run is finished exactly once: finishing a run that is no longer pending, or a run that is not an autopilot run on this ticket, is a 422 on run. Unlike starting a run, finishing does not require the AI agent to still own the ticket — a session that was running when a human took the ticket over is still recorded.

Required scope: support:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Path parameters

  • ticket (integer) — the ticket id.
  • run (integer) — the autopilot run id.

Request body

  • status (string, required) — done, failed or skipped
  • outcome (string, optional, nullable, max 40) — the agent's short code for how the session ended
  • cost_usd (number, optional, nullable, 0–999999) — what the session cost
  • finished_at (ISO-8601 timestamp, optional, nullable) — defaults to now
  • output (object, optional, nullable) — the result summary, stored as given

The response is the finished run. Each run has id, kind (always autopilot), status (pending while the session runs; done, failed or skipped once finished), model, output (the result summary object, or null), run_number (the per-ticket run count), started_at, finished_at, cost_usd (number, or null), outcome (the runner's short code for how the session ended, e.g. awaiting_reply_approval, session_error) and created_at. accepted and decisions are always null on autopilot runs.

Authentication: Bearer token with the support:write scope belonging to the AI agent's own account — any other caller, including support admins, gets a 403. No tenant context — this endpoint is central.

Request​

Responses​

OK

Response Headers
    Content-Type