Tutorial

Human in the Loop Automation: awaiting_human and resume in the runs API

Alex Thompson||5 min
Pg Up

Traditional automation breaks when it hits a prompt, CAPTCHA, or an unknown UI state. The runs API lets you pause a computer use agent when it reaches the awaiting_human state and resume it later with a human answer. You can then continue the task without restarting from the beginning.

How it works

When you POST /v1/runs with on_awaiting_human set to "pause", the server runs the agent. If the agent asks for human input, the run enters the awaiting_human state and stops. You can then fetch the run status with GET /v1/runs/{id} to retrieve the pending question and ask a human. After you receive the answer, you resume the run with POST /v1/runs/{id}/resume, sending the human input as a string. The agent continues from the last action, preserving its trajectory memory.

bash
curl -X POST https://coasty.ai/v1/runs \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $COASTY_API_KEY" \
  -d '{
    "machine_id": "machine-123",
    "task": "Open https://example.com and click the first link",
    "cua_version": "v4",
    "on_awaiting_human": "pause",
    "max_steps": 50,
    "deadline_seconds": 300
  }'

# Suppose the run responds with id: "run-abc" and state: "awaiting_human".

# Ask a human to read the screen and provide the answer.

curl -X POST https://coasty.ai/v1/runs/run-abc/resume \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $COASTY_API_KEY" \
  -d '{
    "human_answer": "The link text is Learn more"
  }'

# The agent continues from the last action with the human input.

Key parameters for human-in-the-loop runs

  • on_awaiting_human: choose "pause" to stop the run when the agent needs human input. Other options are "fail" or "cancel" to abort the run.
  • cua_version: "v4" runs an autonomous agent with a pass/fail verifier. A v3 run uses the default verifier.
  • max_steps and deadline_seconds: set these to prevent infinite loops while the human is responding.
  • GET /v1/runs/{id} returns the current state, which will be "awaiting_human" when the agent paused.
  • POST /v1/runs/{id}/resume sends the human answer as human_answer, a string field.

Set on_awaiting_human to "pause" and resume with POST /v1/runs/{id}/resume when the agent needs human input.

Where this beats brittle automation

Computer use agents see the screen and interact like a human, so they can answer prompts, click dynamic buttons, and fill forms. With awaiting_human you no longer need brittle selectors or hardcoded API calls. You can pause for verification, deal with CAPTCHAs, or collect decisions, then resume the flow seamlessly. This approach reduces false positives and keeps the automation focused on what matters most.

Use awaiting_human and resume to build reliable human-in-the-loop workflows with the runs API. Start building now at https://coasty.ai/developers to get your API key.

Want to see this in action?

View Case Studies
Try Coasty Free