Back to Blog
Tutorial

James Liu5 min
Del

Web scraping breaks when a site adds a CAPTCHA or changes a button class. UI automation that relies on hard selectors needs constant maintenance. The Coasty computer use API solves this by driving a real desktop, browser, or terminal like a human user. With task runs, you can offload a task, pause when you need a human, and resume when you are ready. This post shows how to use the awaiting_human state and the resume endpoint to build reliable human-in-the-loop automation.

How awaiting_human and resume work

When you start a task run, Coasty simulates a user and performs actions step by step. At any point, the server can enter the awaiting_human state if it encounters an ambiguous element, a CAPTCHA, or if you configured on_awaiting_human to pause. You cannot resume a run from the client side without the server saying it is safe to continue. To resume, you POST to /v1/runs/{id}/resume. The request body can include instructions or a system prompt override. The run returns status queued or running. The server continues exactly where it left off. The run state transitions from awaiting_human to running, succeeded, failed, or cancelled. The billing rate stays $0.05 per agent step regardless of the state.

bash
#!/bin/bash
# Start a run that pauses on awaiting_human and resume it
COASTY_API_KEY="$(cat $HOME/.coasty/key)"
RUN_ID="$(curl -s -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 https://example.com and click the login button",
    "cua_version": "v3",
    "on_awaiting_human": "pause"
  }' | jq -r .id)"
echo "Run ID: $RUN_ID"

# Simulate waiting for the run to hit awaiting_human
# In real code, poll GET /v1/runs or stream events

# Resume the run with a human decision
curl -s -X POST https://coasty.ai/v1/runs/$RUN_ID/resume \
  -H "X-API-Key: $COASTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "instructions": "Click the login button",
    "system_prompt": "You are a human operator"
  }' | jq .

on_awaiting_human options

  • pause: the server halts and reports awaiting_human. You can later resume with instructions.
  • fail: the run fails immediately. Use this for safety-critical flows.
  • cancel: the run is cancelled. The run state becomes cancelled.

Resume request fields

The /v1/runs/{id}/resume endpoint accepts instructions and system_prompt as optional overrides. You can append extra guidance so the agent knows what decision a human made. The run ID must match an existing run that is in awaiting_human state. If the run is already running or in a terminal state, the server returns an error. The response includes status and any new run details.

You can resume a run only when status is awaiting_human. Always check the run state before calling /v1/runs/{id}/resume.

Where awaiting_human beats brittle automation

API-only tools break when you need to fill a form, handle a CAPTCHA, or interact with a dynamic UI. Coasty’s computer use agent sees your screen and uses your mouse and keyboard to complete tasks. When it reaches a step that needs a human, it switches to awaiting_human. You can approve, reject, or provide guidance before the rest of the flow continues. This means you can build workflows that handle edge cases, approvals, and exceptions without rewriting selectors for every change.

Human-in-the-loop automation with awaiting_human and resume gives you the best of both worlds: an autonomous agent for the bulk of the work and a human presence for the tricky parts. Start building runs that pause for approval, handle CAPTCHAs, and react to UI changes. Get your API key and start experimenting at https://coasty.ai/developers.

© 2026 Coasty

Backed byYCombinator