Human in the Loop Automation: awaiting_human and resume in the runs API
Building agents that click and type is great, but sometimes you need a human to say go. The runs API gives you exactly that with the awaiting_human state and a resume endpoint. You can spin up a task, let the agent reach a checkpoint, pause for approval, then resume with a single POST. This keeps your workflow reliable without brittle selectors or manual scripting.
How awaiting_human works
When a run hits the awaiting_human state, the agent stops and waits. You can inspect the event stream with GET /v1/runs/{id}/events to see the current screenshot and thought. To resume, send POST /v1/runs/{id}/resume with no body. The run returns to the running state and the agent continues. This pattern lets you hook into any approval flow, approval gates, QA checkpoints, or even a human on a different device.
cat > resume.sh << 'EOF'
#!/usr/bin/env bash
curl -s https://coasty.ai/v1/runs/${RUN_ID}/resume \
-H "Authorization: Bearer $COASTY_API_KEY"
EOF
chmod +x resume.sh
import os
import requests
def await_and_resume(run_id):
api_key = os.getenv("COASTY_API_KEY")
url = f"https://coasty.ai/v1/runs/{run_id}/resume"
r = requests.post(url, headers={"Authorization": f"Bearer {api_key}"})
r.raise_for_status()
return r.json()
if __name__ == "__main__":
run_id = os.getenv("RUN_ID")
print(await_and_resume(run_id))
Key fields and states
- ●State: queued, running, awaiting_human, succeeded, failed, cancelled, timed_out.
- ●Request: POST /v1/runs with machine_id, task, cua_version (default v3, v4 adds pass/fail verifier), on_awaiting_human (pause/ fail/ cancel).
- ●Resume: POST /v1/runs/{id}/resume with no body.
- ●Billing: $0.05 per agent step for task runs and task steps in workflows.
- ●Events: GET /v1/runs/{id}/events streams updates; include Last-Event-ID header to reconnect.
awaiting_human pauses the agent so you can approve, then resume with a single POST /v1/runs/{id}/resume.
Where this beats brittle automation
Traditional automation relies on selectors, IDs, or stable URLs that break when a UI changes. A computer use agent sees the screen, understands context, and can click the right button even if the layout shifts. With awaiting_human and resume, you keep that adaptability while still gating critical steps. You can inspect events, show screenshots to a human, and resume without resetting the whole run.
Add approval gates to your computer use agents with awaiting_human and resume. Build safer workflows that pause for QA or human sign-off, then keep going. Get a key at https://coasty.ai/developers and start authoring runs today.