Automated agents hit walls when they need judgment, legal sign-off, or context you cannot script. The Coasty computer use API gives you reliable human in the loop control with the awaiting_human state. When a run hits this state, the API stops and waits for a resume call. You can inspect logs, collect approval, then POST /v1/runs/{id}/resume. This pattern keeps the agent alive, tracks exactly where it paused, and avoids failing brittle selectors or API-only tools.
How awaiting_human and resume work
When you start a task run, you can set on_awaiting_human to 'pause', 'fail', or 'cancel'. The default is 'pause'. If the agent encounters a condition that requires human input, the run moves to the awaiting_human state. You can poll GET /v1/runs/{id} to see the state. Once you have the human approval, send POST /v1/runs/{id}/resume to continue. The server tracks the trajectory in the session, so the agent resumes from the exact step. The runs API bills $0.05 per agent step regardless of state transitions.
Start a run with awaiting_human as pause
export COASTY_API_KEY="your-key"
# Start a run that pauses for human approval
curl -X POST https://coasty.ai/v1/runs \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"machine_id": "machine-123",
"task": "Open Chrome and navigate to https://example.com",
"cua_version": "v3",
"on_awaiting_human": "pause",
"max_steps": 50,
"deadline_seconds": 600
}'
Polling and resuming from awaiting_human
After the run starts, you can poll GET /v1/runs/{id} to check the state. When the response shows "awaiting_human", you collect the human approval. Then POST /v1/runs/{id}/resume with an optional field "reason" to record why you resumed. The server continues from the last successful step, preserving the session context. If on_awaiting_human is set to fail, the run immediately goes to the failed state. If you set it to cancel, the server cancels the run. The status field in GET /v1/runs/{id} always reflects the current state.
Resume the run after human approval
curl -X POST https://coasty.ai/v1/runs/{id}/resume \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reason": "Human approved navigation"
}'
Handling other states and errors
The runs API exposes states such as queued, running, awaiting_human, succeeded, failed, cancelled, and timed_out. You can GET /v1/runs/{id}/events to stream detailed events and reconnect using the Last-Event-ID header. Common errors include 401 invalid key, 402 INSUFFICIENT_CREDITS, 403 INSUFFICIENT_SCOPE, and 429 rate limit. These map to JSON error objects with code, message, and request_id. Always check the error code before retrying. The runs API bills $0.05 per agent step, so monitor your prepaid wallet balance.
Set on_awaiting_human to pause when you need human judgment, then POST /v1/runs/{id}/resume after approval.
Why computer use beats brittle automation
API-only tools require stable endpoints and predictable JSON schemas. They break when UI changes, buttons move, or error messages shift. The Coasty computer use agent sees the screen like a human. It clicks, types, and scrolls based on visual context. When you add awaiting_human, you keep the visual reliability while injecting human judgment. This combination reduces flakiness and lets you automate complex workflows that need approval, verification, or context-specific actions.
Use awaiting_human and resume to build robust human in the loop automation. Start a run, pause at approval points, resume with POST /v1/runs/{id}/resume, and stream events for full visibility. Get a key at https://coasty.ai/developers and start building reliable computer use workflows.
Want to see this in action?
View Case Studies