API-only automation fails when UI changes, elements load late, or an app needs a human decision. The runs API can pause at the awaiting_human state, let you review or approve, then resume with a single API call. This keeps your agent capable of complex tasks without brittle selectors.
How awaiting_human and resume work
When you submit a run with on_awaiting_human: "pause", the server enters the awaiting_human state instead of failing. You poll GET /v1/runs to see the status. When it is awaiting_human, you inspect the event stream for your prompt, approve, and call POST /v1/runs/{id}/resume with a human_feedback object. The server continues with the next agent step. Each task step costs $0.05. The agent is billed per step, not per pause.
#!/usr/bin/env bash
set -euo pipefail
COASTY_API_KEY="${COASTY_API_KEY}"
RUN_ID="your-run-id-here"
# 1. Start a run that pauses on human approval
# POST /v1/runs
run_resp=$(curl -s -X POST https://coasty.ai/v1/runs \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"machine_id": "your-machine-id",
"task": "Open Chrome, navigate to https://example.com, and click the first link",
"cua_version": "v3",
"on_awaiting_human": "pause",
"max_steps": 50,
"deadline_seconds": 600,
"webhook_url": "https://your-domain.com/hooks/coasty"
}')
RUN_ID=$(echo "$run_resp" | jq -r '.run.id')
echo "Run started: $RUN_ID"
# 2. Wait until the run reaches awaiting_human
while true; do
run_status=$(curl -s -X GET https://coasty.ai/v1/runs/$RUN_ID \
-H "X-API-Key: $COASTY_API_KEY")
status=$(echo "$run_status" | jq -r '.run.status')
echo "Status: $status"
if [ "$status" = "awaiting_human" ]; then
break
elif [ "$status" = "succeeded" ] || [ "$status" = "failed" ] || [ "$status" = "cancelled" ]; then
echo "Run ended with $status"
exit 0
fi
sleep 2
done
# 3. Stream events to see the human approval prompt
curl -s -N -H "X-API-Key: $COASTY_API_KEY" \
https://coasty.ai/v1/runs/$RUN_ID/events \
| grep -i "human_approval"
# 4. Resume the run with approval
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 '{
"human_feedback": {
"action": "approve"
}
}'
echo "Run resumed. Poll status again to see progress."
Key fields and behaviors
- on_awaiting_human: set to "pause" to enter the awaiting_human state instead of failing.
- Statuses: queued, running, awaiting_human, succeeded, failed, cancelled, timed_out.
- GET /v1/runs returns the current status and run details.
- GET /v1/runs/{id}/events streams Server-Sent Events. Use Last-Event-ID for reconnection.
- POST /v1/runs/{id}/resume accepts human_feedback with an action field such as "approve".
- Each task step in the workflow is billed $0.05.
- The agent drives real desktops, browsers, and terminals, not just API calls.
Set on_awaiting_human: "pause" to enter the awaiting_human state, then resume with POST /v1/runs/{id}/resume.
Where awaiting_human beats brittle automation
API-only tools fail when elements change selectors, load asynchronously, or need a human judgment. A computer use agent sees the screen, understands context, and can click dynamically generated buttons or fill forms with free text. The awaiting_human state lets you pause for approval, inspect logs, and fix issues without restarting the whole run. This keeps your automation reliable across UI changes and complex workflows.
Build workflows that pause for human oversight, then resume automatically. Use machine_id to drive VMs with real desktops and browsers. Get your API key at https://coasty.ai/developers and start building human-in-the-loop automation with the Coasty computer use API.
Want to see this in action?
View Case Studies