v1

latestOpenAPI 3.1.0MIT2026-08-0481194343.8 KB
runs

Start an autonomous run

Scope: runs:write. Drives task to completion on machine_id, running the screenshot→act→verify loop server-side. Managed defaults charge 5 credits per completed agent step on v3/v4/v5 and 8 on v1. With a live Coasty key, BYOK runs every role on YOUR provider key and debits zero Coasty platform credits for creation and every step, while persisting actual provider tokens; no wallet runway is required. Under test auth, a managed-mode run remains deterministic sandbox execution. Any BYOK header or provider metadata instead returns 422 LLM_PROVIDER_UNSUPPORTED before execution: BYOK is unavailable for synthetic test runs, workflows, and schedules. Use managed mode or a live Coasty API key. Test execution never decrypts or requires a stored provider key and does not call or bill Anthropic/OpenAI. Run steps do not inherit /v1/predict trajectory, HD-image, or combined-prompt surcharges. Idempotency-Key deduplicates top-level creation, not later GUI/terminal/file side effects. webhook_secret is returned only by create/replay; a live BYOK key snapshot is encrypted for crash recovery and scrubbed at terminal state.

post/v1/runs

Headers

Idempotency-Keystring

Optional client-supplied key (≤128 chars, [A-Za-z0-9_-:]) for safe retries. Keys are global within one concrete API-key credential plus live/test mode; never reuse one on another endpoint. 'Same request' = a SHA-256 of an explicit operation discriminator plus the canonical (sorted-key) JSON body (session_id is folded in for /sessions/{id}/predict). LLM-capable operations also bind the non-secret effective provider, role models, and one-way provider-key fingerprint; plaintext provider keys never enter the hash or replay record. Replays the response for 24 h when operation, body, and effective execution identity match (X-Coasty-Idempotent-Replay: true and X-Credits-Charged: 0). Action screenshot pixels are response-only and deliberately omitted from replay storage; a replay retains frame_id but returns screenshot=null and observation_available=false. Inference replays also set body usage.credits_charged=0 and usage.billed=false; machine-snapshot bodies retain the original gross charge for auditability. A retry while the original is still running waits up to ~25 s then returns the result, otherwise 409 IDEMPOTENCY_IN_FLIGHT (retry with the SAME key). Returns 422 IDEMPOTENCY_KEY_REUSED if any bound input differs. Rotating the API key starts a new replay namespace. Collect a lost result via GET /v1/idempotency/{key} using the original credential.

X-LLM-Provider'anthropic' | 'openai'

BYOK: which provider the X-LLM-Api-Key belongs to (anthropic | openai). Required whenever X-LLM-Api-Key is sent — a key without a provider is a 422 LLM_PROVIDER_UNSUPPORTED. With a live Coasty key, selecting BYOK runs the entire harness on your provider account with no platform fallback and zero Coasty inference credits. Under test auth, predict, ground, and session create require an explicit per-request X-LLM-Api-Key; a body provider without that header fails with 422 LLM_KEY_NOT_CONFIGURED because test auth never reads a stored live provider key. Session create fixes the explicit key for inherited predicts without inference. Managed-mode Tasks, Workflows, and schedules remain deterministic sandbox executions; BYOK intent on them fails before execution with 422 LLM_PROVIDER_UNSUPPORTED. They never decrypt or require a stored provider key and make no provider call.

X-LLM-Api-Keystring

BYOK provider credential supplied on this request. Lifecycle depends on the operation: predict/ground use it for that call; session create retains a fixed owner-process copy for inherited predicts; Run/Workflow creation snapshots it encrypted until terminal state; schedule create uses it only to validate the current stored key and persists no credential. It requires an effective anthropic/openai provider; combining it with body llm.provider='managed' is 422. Under live auth, immediate operations prefer this header over a stored key. Schedules fire without headers, so the header key must match the stored key and each fire resolves the current stored key. Never logged or echoed. With a test Coasty key, explicit BYOK is provider-direct only for the direct CUA flow: POST /v1/predict, POST /v1/ground, POST /v1/sessions, and POST /v1/sessions/{id}/predict. Predict, ground, and session create require this explicit per-request header plus X-LLM-Provider; body llm.provider without it returns 422 LLM_KEY_NOT_CONFIGURED (Stored provider keys are unavailable for test API keys. Send X-LLM-Api-Key explicitly for direct BYOK.) and test auth never reads or uses a stored live provider key. Session create fixes the explicit key for inherited session predicts but makes no inference call; predict, ground, and session predict can call and bill Anthropic/OpenAI. Managed-mode test Tasks, Workflows, and schedules remain deterministic sandbox. Supplying BYOK headers or provider metadata to them returns 422 LLM_PROVIDER_UNSUPPORTED (BYOK is unavailable for synthetic test runs, workflows, and schedules. Use managed mode or a live Coasty API key.) before execution. They never decrypt or require a stored provider key and do not call or bill Anthropic/OpenAI. Keep provider secrets out of sandbox and CI requests; use a live Coasty key for real asynchronous execution.

X-LLM-Modelstring

BYOK model selection for this operation (equivalent to body llm.model). Sessions retain it for inherited predicts, Runs/Workflows snapshot it, and schedules persist the non-secret selection for later fires. Defaults: claude-sonnet-5 (anthropic), gpt-5.6-sol (openai). The same 1-256-character model-id syntax applies; invalid ids return 422 LLM_MODEL_INVALID. The provider can still reject an unknown or inaccessible model; it must be vision-capable.

Request body

machine_idstring required

Target managed or connected external machine id (must be owned by the key's user).

taskstring required

Natural-language task to drive to completion.

cua_version'v1' | 'v3' | 'v4' | 'v5'

CUA engine version. Defaults to the latest (v5); available on all tiers.

instructionsstring nullable

Appended to the base agent prompt.

system_promptstring nullable

Custom preamble prepended to the task; it does not replace the built-in tool-aware agent system prompt. Shares the tier custom-prompt budget with instructions.

modelstring nullable

Legacy top-level model selection (prefer llm.model for BYOK). Model ids are 1-256 characters, begin with a letter or number, and then use only letters, numbers, dot, underscore, colon, slash, plus, at-sign, or hyphen. Secret-shaped values such as sk-* keys, bearer credentials, authorization values, or API-key/secret assignments are rejected without reflection as 422 LLM_MODEL_INVALID; provider credentials belong only in X-LLM-Api-Key.

max_stepsinteger

Hard cap on agent steps (clamped to the server ceiling).

deadline_secondsinteger nullable

Wall-clock budget in seconds (clamped).

on_awaiting_human'pause' | 'fail' | 'cancel'

Behaviour when the agent needs a human.

awaiting_human_timeout_secondsinteger nullable
webhook_urlstring nullable

HTTPS URL for HMAC-signed run-event deliveries.

metadataobject nullable

Opaque key/value map echoed back (≤50 keys).

Response

Run created (status "queued").

idstring required
object'agent.run' required
status'queued' | 'running' | 'awaiting_human' | 'succeeded' | 'failed' | 'cancelled' | 'timed_out' required
machine_idstring nullable
taskstring
cua_versionstring
instructionsstring nullable
max_stepsinteger
deadline_secondsinteger

EFFECTIVE wall-clock budget after the server applied its ceiling. Echoed back so a clamp is never silent: request 86400 against a lower server ceiling and you see the value the run is actually held to, instead of discovering it as a surprise DEADLINE_EXCEEDED.

awaiting_human_timeout_secondsinteger

EFFECTIVE awaiting-human timeout after the server applied its ceiling, echoed back for the same reason as deadline_seconds.

on_awaiting_humanstring
steps_completedinteger
credits_chargedinteger
cost_centsinteger
resultobject nullable

Terminal outcome envelope: passed (boolean), status, summary, usage, and verdict only when a verifier pass ran. summary is the LAST 2000 characters of the trajectory, so it carries the agent's final answer; it is not the full trajectory and there is no output field. To read a complete trajectory, or a final answer you intend to parse, use GET /v1/runs/{run_id}/log.

errorobject nullable
awaiting_human_reasonstring nullable
metadataobject nullable
webhook_urlstring nullable

Lifecycle callback destination. Agent Run terminal callbacks are transactionally queued in a durable outbox and delivered at least once, with at most 3 durably recorded delivery attempts. A crash after HTTP send but before durable acknowledgement can add duplicate physical sends. Stable Coasty-Delivery equals body id and logical delivered_at survives retries; receivers must deduplicate it. The non-terminal awaiting-human callback is best-effort in-process, can be missed on a worker failure, and uses (run.id, event, run.awaiting_human_since) for deduplication. GET the run for authoritative state.

webhook_secretstring nullable

Returned by create and its exact bounded Idempotency-Key replay; null on get/list. The pinned per-run secret is encrypted at rest through delivery/replay recovery and later scrubbed. Verify raw-body deliveries with HMAC-SHA256 before accepting the Coasty-Delivery deduplication key.

created_atstring nullable
started_atstring nullable
awaiting_human_sincestring nullable
finished_atstring nullable
request_idstring nullable