Back to Blog
Tutorial

David Park10 min
Ctrl+A

Automation often breaks when UI changes, approvals are needed, or retries fail. A traditional script keeps going and produces errors. The Coasty computer use API lets you pause a task and request human input. When the human acts, you resume the same run. This reduces retries and gives you reliable workflows without rewriting your entire pipeline.

How it works

You start a task run with POST /v1/runs. Set on_awaiting_human to "pause". The run enters the "awaiting_human" state. You poll GET /v1/runs/{id} to check the state. When the status is "awaiting_human", you show the user a screenshot and ask for approval. Once the user approves or provides input, you resume with POST /v1/runs/{id}/resume. The run continues from the last successful action and bills only for completed steps.

bash
# Start a run that pauses for human approval
COASTY_API_KEY=$(echo $COASTY_API_KEY)

# POST /v1/runs: start a task run that will pause for human input
curl -X POST https://coasty.ai/v1/runs \
  -H "X-API-Key: $COASTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "machine_id": "m-12345",
    "task": "Open Chrome, go to https://example.com, take a screenshot, and upload it",
    "cua_version": "v3",
    "on_awaiting_human": "pause",
    "max_steps": 120,
    "deadline_seconds": 600
  }' | jq '.id.status'

# GET /v1/runs/{id}: check the run state
RUN_ID="$(curl -s -X GET https://coasty.ai/v1/runs \
  -H "X-API-Key: $COASTY_API_KEY" | jq -r '.runs[0].id')"

curl -s -X GET "https://coasty.ai/v1/runs/$RUN_ID" \
  -H "X-API-Key: $COASTY_API_KEY" | jq '.status'

# POST /v1/runs/{id}/resume: continue after human approval
curl -s -X POST "https://coasty.ai/v1/runs/$RUN_ID/resume" \
  -H "X-API-Key: $COASTY_API_KEY" | jq '.status'

Key fields and states

  • POST /v1/runs: body fields include machine_id, task, cua_version (default v3), on_awaiting_human (pause/fail/cancel), max_steps, deadline_seconds.
  • on_awaiting_human: set to "pause" to stop at the first awaiting_human event.
  • States: queued, running, awaiting_human, succeeded, failed, cancelled, timed_out.
  • GET /v1/runs/{id}: returns status, current step, and events.
  • POST /v1/runs/{id}/resume: continues the run from the last successful action.
  • Billing: $0.05 per agent step, charged only for completed steps.

Set on_awaiting_human to "pause" in POST /v1/runs and resume with POST /v1/runs/{id}/resume when the human approves.

Where this beats brittle automation

Traditional automation relies on selectors and fixed endpoints. When a button moves or a site changes, scripts break. The Coasty computer use API drives an agent that sees the screen, reads text, and clicks based on what it perceives. You can pause and ask a human to approve an action, fix a wrong click, or provide additional context. The resume step restores the exact state, so you do not lose progress or need to re-run the whole workflow. This approach works across browsers, desktop apps, and terminals without selector maintenance.

Build adaptive automation that pauses for approvals, handles edge cases, and resumes reliably. Start a run with on_awaiting_human: "pause" and resume when the human responds. Get your API key at https://coasty.ai/developers.

© 2026 Coasty

Backed byYCombinator