Checkout forms are unpredictable. Layouts change, hidden fields appear, and CAPTCHAs block simple selectors. Use the Coasty Computer Use API to drive a real desktop. The server sees the screen and acts like a human, completing form inputs and checkout without brittle XPath or CSS selectors. You get a stateful run with events streamed via Server-Sent Events and a webhook when the flow finishes.
How it works
The flow starts with a POST /v1/runs request. You provide a machine_id, a task description, and options like max_steps and deadline_seconds. The server provisions a cloud VM, launches the browser, and runs the agent. Each agent step is billed $0.05. The run returns an id and a short status. You poll or stream events to track progress. The run state can be queued, running, awaiting_human, succeeded, failed, cancelled, or timed_out. When awaiting_human, you can pause, fail, or cancel the run using POST /v1/runs/{id}/cancel or POST /v1/runs/{id}/resume. A webhook_url lets the server notify you when the run completes.
#!/usr/bin/env bash
set -e
COASTY_API_KEY=${COASTY_API_KEY?"Please set COASTY_API_KEY"}
machine_id="my-prod-machine"
task="Go to https://example.com/checkout, fill the shipping form, fill the payment form, and click the place order button. Verify that the confirmation page appears."
# Start the task run
run_response=$(curl -s -X POST https://coasty.ai/v1/runs \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"machine_id": "'$machine_id'",
"task": "'$task'",
"cua_version": "v4",
"max_steps": 50,
"deadline_seconds": 300,
"on_awaiting_human": "pause",
"webhook_url": "https://example.com/hooks/coasty"
}')
run_id=$(echo "$run_response" | jq -er '.id')
echo "Run id: $run_id"
# Stream events until we see a final state
while true; do
events=$(curl -s -N -H "X-API-Key: $COASTY_API_KEY" \
"https://coasty.ai/v1/runs/$run_id/events")
# Print events
echo "$events" | jq -c '.[]'
# Check for final states
final=$(echo "$events" | jq -s 'map(select(.status == "succeeded" or .status == "failed" or .status == "cancelled" or .status == "timed_out"))')
if [ $(echo "$final" | jq 'length') -gt 0 ]; then
break
fi
sleep 2
doneKey fields and options
- machine_id: The cloud VM to drive.
- task: A concise command in natural language. The agent interprets this to drive the browser and interact with the page.
- cua_version: Use "v4" for an autonomous run with a pass/fail verifier. The default is "v3".
- max_steps: The maximum number of agent steps allowed. Each step is billed $0.05.
- deadline_seconds: The deadline in seconds after which the run is cancelled if not finished.
- on_awaiting_human: "pause" to halt the run when a human approval is needed. Options: pause, fail, cancel.
- webhook_url: A URL to receive a POST when the run completes. The server signs the webhook with the header "Coasty-Signature" and an HMAC over the payload.
Each agent step is billed $0.05, and a human approval is configurable via on_awaiting_human.
Where this beats brittle automation
Traditional automation relies on selectors that break when a class name changes or when a hidden field appears. The Coasty Computer Use API drives a real desktop, sees the screen with the vision model, and clicks, types, and scrolls like a human. You do not need to maintain a brittle selector map. You can handle CAPTCHAs, dynamic forms, and multi-step flows because the agent reasons about the page state and continues until the task is done. You can also integrate with the MCP server from Cursor or Claude Desktop to orchestrate these runs from your editor.
Next steps
- Provision a machine with POST /v1/machines to get a machine_id.
- Use POST /v1/runs to start an autonomous checkout or form flow.
- Stream events with GET /v1/runs/{id}/events or poll GET /v1/runs/{id}.
- Cancel or resume a run with POST /v1/runs/{id}/cancel and POST /v1/runs/{id}/resume.
- Explore workflows to orchestrate multiple runs with conditions, loops, and parallel execution.
The Coasty Computer Use API lets you build reliable form filling and checkout agents without brittle selectors. Start building with a key at https://coasty.ai/developers.
Want to see this in action?
View Case Studies