Common automation tasks need a human judgment call. A login prompt, a rare corner case, or a missing file triggers a pause. You want the agent to stop, wait for your input, and then continue. You want it to fail gracefully if you do not intervene, or cancel the run if it is not urgent. The runs API gives you these controls with the on_awaiting_human field and the cancel or resume endpoints.
How it works
When a run reaches a point that needs a human, the server sets the status to awaiting_human. You can configure the behavior by passing on_awaiting_human in the POST /v1/runs request. The options are pause, fail, or cancel. If you choose pause, the run stays in awaiting_human and you can call POST /v1/runs/{id}/resume to continue. If you choose fail, the run ends with status failed. If you choose cancel, the run ends with status cancelled. You can monitor events with GET /v1/runs/{id}/events using Server-Sent Events, reconnecting with the Last-Event-ID header.
curl --request POST https://coasty.ai/v1/runs \
--header "X-API-Key: $COASTY_API_KEY" \
--header "Content-Type: application/json" \
--data '{
"machine_id": "vm-12345",
"task": "Open a browser and navigate to https://example.com",
"cua_version": "v4",
"on_awaiting_human": "pause",
"max_steps": 200,
"deadline_seconds": 600
}'
# Get the run ID from the response, then poll events:
curl --request GET https://coasty.ai/v1/runs/{run_id}/events \
--header "X-API-Key: $COASTY_API_KEY" \
--header "Accept: text/event-stream"
# When status is awaiting_human, resume:
curl --request POST https://coasty.ai/v1/runs/{run_id}/resume \
--header "X-API-Key: $COASTY_API_KEY"Key fields and options
- on_awaiting_human: pause, fail, or cancel. Choose pause to let the run wait for human action.
- status: changes to queued, running, awaiting_human, succeeded, failed, cancelled, or timed_out.
- max_steps: limits the number of agent steps. Each step costs $0.05.
- deadline_seconds: stops the run after this many seconds.
- GET /v1/runs/{id}/events: streams events with a Last-Event-ID header for reconnection.
Set on_awaiting_human to pause, then resume with POST /v1/runs/{id}/resume.
Where this beats brittle automation
Traditional automation relies on precise selectors, stable IDs, and brittle API contracts. A single UI change breaks the script. The computer use agent sees the screen like a human. When it encounters a login dialog or a missing file, it can pause and let you resolve it. This makes workflows robust to UI changes and edge cases without rewriting selectors. You only need to fix the human-step logic, not every selector.
Combine the runs API with workflows and machines to build human-in-the-loop pipelines for login flows, approval gates, and testing. Get your API key at https://coasty.ai/developers and start building reliable automation.
Want to see this in action?
View Case Studies