Automating Form Filling and Checkout Flows Over the Computer Use API
Most checkout flows rely on dynamic IDs, changing classes, and complex validation. Traditional automation tools break when the layout shifts. With the Coasty computer use API you can drive a real browser or desktop, see the screen, and click the right elements just like a human. This tutorial shows you how to build a checkout automation that works against real web stores and desktop apps.
How the Coasty computer use API handles checkout flows
You start by creating a machine with POST /v1/machines. This provisions a cloud VM that hosts a desktop or browser. Then you launch a task run with POST /v1/runs. The request body includes machine_id, task, cua_version, and optional instructions. The API charges $0.05 per agent step. The server runs a computer use agent that sees the screen, follows instructions, and interacts with elements until the run reaches succeeded, failed, or cancelled.
#!/bin/bash
COASTY_API_KEY="${COASTY_API_KEY}"
MACHINE_ID="$(curl -s -X POST https://coasty.ai/v1/machines \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "checkout-machine"}' | jq -r '.id')"
RUN_ID=$(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\": \"Navigate to https://shop.example.com/products/t-shirt and add a size M, color blue, and quantity 2 to the cart. Then go to checkout, fill in your email, zip, and card details. Submit the order.\",
\"cua_version\": \"v3\"
}" | jq -r '.id')
echo "Run ID: $RUN_ID"
curl -s -X GET "https://coasty.ai/v1/runs/$RUN_ID" \
-H "X-API-Key: $COASTY_API_KEY" | jq '.status.error'Key fields for form filling and checkout
- ●machine_id: identifies the provisioned VM that hosts the desktop or browser.
- ●task: plain language instruction that the computer use agent follows.
- ●cua_version: v3 for guided runs, v4 for autonomous runs with a pass/fail verifier.
- ●instructions (optional): appended to the base prompt to guide behavior.
- ●deadline_seconds: how long the run can run before timing out.
- ●on_awaiting_human: pause, fail, or cancel when the agent needs human input.
- ●webhook_url (optional): receive events about run state changes.
POST /v1/runs charges $0.05 per agent step and returns a run ID you can poll or stream with GET /v1/runs/{id}/events.
Where this beats brittle automation
Checkout forms change their classes and IDs each release. API-only tools must constantly update selectors. The computer use agent sees the actual rendered screen, identifies labels and buttons, and clicks the right element. It can handle CAPTCHAs, popups, and layout shifts without code changes. You focus on the business logic and let the agent handle the UI.
You can now build checkout agents that work against real web stores and desktop apps. Try the POST /v1/machines and POST /v1/runs endpoints today. Get your API key at https://coasty.ai/developers and start automating with the Coasty computer use API.