Back to Blog
Tutorial

Sophia Martinez6 min
Pg Up

Many automation tasks need human input at specific points, approval workflows, security checks, or onboarding sequences. The Coasty Runs API gives you two signals for that: the on_awaiting_human action that tells the system to pause the run, and the POST /v1/runs/{id}/resume endpoint to continue execution later. You send a task, get a run ID, and the server transitions the run to the awaiting_human state. You either wait for a webhook or poll /v1/runs/{id}/events, then resume with the same run ID.

How awaiting_human and resume work

When the agent reaches an action that requires human input, it sets status to awaiting_human. The run remains in memory, preserving all trajectory and state. You can resume from that state by sending a POST /v1/runs/{id}/resume request with the same run ID. The server then proceeds from the last successful step. The run lifecycle includes queued, running, awaiting_human, succeeded, failed, cancelled, or timed_out states.

bash
Create a run that pauses for human approval and then resume it.

# Create a run that pauses for human input
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": "your-machine-id",
    "task": "Open Chrome, navigate to https://example.com, and click the login button",
    "cua_version": "v4",
    "max_steps": 20,
    "on_awaiting_human": "pause"
  }' | jq -r .id)

echo "Run ID: $RUN_ID"

# Poll for status until awaiting_human
for i in {1..30}; do
  STATUS=$(curl -s -X GET "https://coasty.ai/v1/runs/$RUN_ID" \
    -H "X-API-Key: $COASTY_API_KEY" | jq -r .status)
  echo "Step $i: status = $STATUS"
  if [ "$STATUS" = "awaiting_human" ]; then
    break
  fi
  sleep 2
done

# Resume the run
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 and enter your username and password" }'

# Wait for completion
while true; do
  STATUS=$(curl -s -X GET "https://coasty.ai/v1/runs/$RUN_ID" \
    -H "X-API-Key: $COASTY_API_KEY" | jq -r .status)
  echo "Run status: $STATUS"
  if [ "$STATUS" = "succeeded" ] || [ "$STATUS" = "failed" ]; then
    break
  fi
  sleep 3
done

echo "Run finished with status: $STATUS"

Key fields and billing

  • POST /v1/runs sets on_awaiting_human to pause, fail, or cancel when the agent reaches a human prompt.
  • Runs are billed $0.05 per agent step, including steps that enter the awaiting_human state.
  • GET /v1/runs/{id}/events streams Server-Sent Events for real-time status updates and reconnect with Last-Event-ID.
  • POST /v1/runs/{id}/resume accepts instructions that append to the base prompt, overriding or extending the original task.
  • GET /v1/runs/{id} returns the current status and trajectory snapshot for debugging and logging.

on_awaiting_human: set to pause to keep the run in memory so you can resume later with POST /v1/runs/{id}/resume.

Where awaiting_human beats brittle automation

Traditional automation relies on selectors, XPath, and hard-coded element IDs. If layout changes or a UI component shifts, the script breaks. A computer use agent reads the screen with vision, interprets text and layout, and can handle dynamic UIs. The awaiting_human signal lets you insert approval steps or walkthroughs without rewriting selectors. You keep the same agent trajectory, just hand off to a human at the right moment, then resume from that exact point.

Use on_awaiting_human to pause runs for human review, collect approvals, or adapt to context, then resume with POST /v1/runs/{id}/resume. Pair this with workflow DSL steps, retry logic, and machine snapshots for robust, complex automation. Get your API key and start building human-in-the-loop workflows at https://coasty.ai/developers.

© 2026 Coasty

Backed byYCombinator