SaaS and e-commerce sites change their UI nearly every release. Form fields shift, labels move, and selectors break. Building checkout flows manually with brittle selectors is expensive and error-prone. The Coasty Computer Use API lets you drive a real desktop session like a human, reading the screen and acting on it. This guide shows how to automate form filling and checkout flows over the API.
How it works
The computer use API uses task runs to drive an agent on a machine. You POST to /v1/runs with a task, machine_id, and cua_version. The server provisions a cloud VM, launches the agent, and streams events back as Server-Sent Events. Each agent step costs $0.05. The agent captures screenshots, predicts actions, and executes them until the task is done or the deadline passes. You can pause, cancel, or resume runs.
curl -X POST https://coasty.ai/v1/runs \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"machine_id": "vm-prod-us-east-1",
"task": "Go to https://checkout.example.com, fill the email field with [email protected], fill the zip code field with 90210, and click the Place Order button.",
"cua_version": "v4",
"max_steps": 100,
"deadline_seconds": 300
}'Deep dive: request and response fields
- POST /v1/runs body fields: machine_id (required), task (required), cua_version (v3 or v4), instructions (optional string appended to the base prompt), system_prompt (optional string), max_steps (optional integer, default unspecified), deadline_seconds (optional integer in seconds), on_awaiting_human (optional one of pause, fail, cancel), webhook_url (optional URL for completion notifications).
- Returned run object fields: id (run identifier), state (one of queued, running, awaiting_human, succeeded, failed, cancelled, timed_out), created_at, started_at, completed_at, steps_taken, errors, and any user-provided instructions or system prompts. Events are streamed via GET /v1/runs/{id}/events as Server-Sent Events with Last-Event-ID for reconnection. Each agent step is billed $0.05. The v4 cua_version runs with a built-in pass/fail verifier and autonomous execution.
Task runs bill $0.05 per agent step, and you can pause, resume, or cancel them from the API.
Where this beats brittle automation
Most checkout flows rely on CSS selectors, XPath, or Playwright APIs. When a site adds a new label, shifts a field down by one line, or changes the class name, those selectors break and you need new tests. The computer use agent reads the actual rendered UI, matches labels to fields visually, and clicks buttons exactly where they appear. It also handles dynamic content, CAPTCHAs that need human-like reasoning, and modal dialogs that appear only under certain conditions. The agent sees the same screen a human sees, so your automation stays reliable across releases.
Building a complete form filling and checkout workflow
- Use a machine with an up-to-date OS and browser (e.g., vm-prod-us-east-1) to ensure the agent has the same capabilities as a real user.
- Provide a clear task that describes each step: navigate to the URL, identify the email field by its label, enter the email value, navigate to the zip code field, enter the zip code, locate the Place Order button, and click it.
- Set an appropriate deadline_seconds to allow for navigation, typing, and potential delays. If the agent gets stuck waiting for a human (e.g., a CAPTCHA), on_awaiting_human determines whether to pause, fail, or cancel the run.
- Monitor events via GET /v1/runs/{id}/events to track progress, capture screenshots, and handle any errors during the run.
You can now automate form filling and checkout flows with a computer use agent that reads and acts on the real UI. Start building at https://coasty.ai/developers to get your API key and provision a machine. The Coasty Computer Use API gives you reliable, human-like automation without brittle selectors.
Want to see this in action?
View Case Studies