Engineering

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

Alex Thompson||8 min
Del

Many autonomous agents eventually hit a state they cannot resolve without human input, such as a CAPTCHA, a security prompt, or a policy decision. A brittle automation stack either fails fast or forces you to add a hardcoded approval step that does not scale. The runs API lets you pause an agent when it encounters awaiting_human, store the run state, and resume it later exactly where it stopped. This preserves context, avoids re-executing steps, and lets you integrate approval flows on any channel you control.

How awaiting_human and resume work

When a task run reaches the awaiting_human state, the agent has encountered a trigger that requires human input. You get an event stream with an awaiting_human event and the run remains in the running state. You can then call POST /v1/runs/{id}/resume with an optional human_input field to provide the required input, or cancel the run entirely. The run resumes from the current step using the same trajectory and state, so the agent continues logically where it left off. The workflow DSL also supports the human_approval step, which explicitly triggers this behavior and can be guarded by conditions and variables.

bash
#!/usr/bin/env bash
set -euo pipefail

COASTY_API_KEY="${COASTY_API_KEY}"
RUN_ID="your-run-id-here"

# Resume a run that is waiting for human input
# Replace with a real human_input value from your approval system
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_input": "approve"
  }' | jq '.'

Use cases and guardrails

  • CAPTCHA or 2FA prompts that require human verification
  • Policy decisions that should be reviewed by a human before proceeding
  • Multi-step approval workflows where each step can be awaited and resumed independently
  • Budget or iteration limits that trigger human intervention and resume once approved
  • Deadline enforcement: resume only before the deadline_seconds limit to avoid timeouts

awaiting_human pauses the run; resume with human_input to continue from the same step.

Where this beats brittle automation

A pure API-only tool must guess how a UI will change and hard-code selectors that break on layout updates. A computer use agent that sees the screen can recognize a CAPTCHA, a dialog, or a policy banner and safely transition to awaiting_human, letting you resolve it outside the automation pipeline. Only one server-side retry or approval is needed, and the agent never retries the same step after a human input. This approach scales across different apps and versions without changing your selectors.

You can now build interactive agents that pause for approvals, handle CAPTCHAs, or gate sensitive actions on human judgment. The runs API keeps state across pauses so you can resume from the same step without re-execution. Get a key at https://coasty.ai/developers and start building human-in-the-loop workflows with the computer use API.

Want to see this in action?

View Case Studies
Try Coasty Free