Human in the Loop Automation: Awaiting Human and Resume in the Runs API
Robust automation often hits gray areas. A tool could be in a modal, a badge could have a different class, or a dynamic element might not exist yet. Instead of failing or guessing, you want your agent to ask a human for guidance, then continue from the same state. The Coasty Runs API supports exactly this pattern with on_awaiting_human and resuming a run. You can control how the agent behaves when it needs interaction, then pick up where it left off with a simple resume call.
How on_awaiting_human and resume work
When you start a task run, you pass on_awaiting_human to decide what happens when the agent encounters a state that requires human input. You can set it to "pause", "fail", or "cancel". If you set it to "pause", the run enters the awaiting_human state. You can then poll the run status with GET /v1/runs/{id} or stream events with GET /v1/runs/{id}/events. When you are ready, call POST /v1/runs/{id}/resume to continue from the same state. The agent retains its trajectory memory, so it resumes with the same context.
curl -X POST https://coasty.ai/v1/runs \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"machine_id": "cloud-vm-123",
"task": "Navigate to https://example.com, then log in with username "john" and password "s3cr3t"",
"cua_version": "v3",
"on_awaiting_human": "pause",
"max_steps": 50,
"deadline_seconds": 300
}' | jqKey fields for human-in-the-loop
- ●machine_id: The cloud VM ID you provisioned with POST /v1/machines.
- ●task: The natural language instruction for the agent.
- ●cua_version: The model version to use, "v3" for guided tasks or "v4" for autonomous with a pass/fail verifier.
- ●on_awaiting_human: "pause" to stop and wait, "fail" to immediately end the run, or "cancel" to abort it.
- ●max_steps: The maximum number of agent steps before the run times out internally.
- ●deadline_seconds: The absolute deadline for the entire run.
- ●webhook_url: Optional URL to receive status updates via webhook.
- ●GET /v1/runs/{id}: Poll for run status (queued, running, awaiting_human, succeeded, failed, cancelled, timed_out).
- ●GET /v1/runs/{id}/events: Server-Sent Events stream for real-time updates, reconnect with Last-Event-ID.
- ●POST /v1/runs/{id}/resume: Continue a paused run from the same state.
Set on_awaiting_human to "pause" and resume with /v1/runs/{id}/resume to keep your computer use agent running until you approve the next step.
Where this beats brittle automation
Traditional automation relies on selectors, classes, and fixed locators. When UI changes, those selectors break. A computer use agent, however, sees the screen and acts like a human. It can recognize buttons, input fields, and dynamic patterns based on visual context. By pausing on ambiguous steps and resuming with human input, you combine the resilience of computer vision with the control of human judgment. This reduces false positives and flaky pipelines, especially when dealing with complex or enterprise applications where the UI is not documented.
Start building agents that pause on unclear steps and resume with human guidance. Set on_awaiting_human to "pause" and resume with POST /v1/runs/{id}/resume to keep your automation running until you approve. Get your API key and start exploring at https://coasty.ai/developers .