Tutorial

Automating Form Filling and Checkout Flows Over the Computer Use API

David Park||6 min
+T

Form fields, dropdowns, and checkout flows break brittle CSS selectors and static selectors. When you rely on XPath, IDs, or class names, a single layout change defeats your script. The Coasty Computer Use API solves this by giving your agent a real view of the desktop or browser and letting it act like a human. It captures the screen, interprets it, and performs actions until the task is done. This post shows how to automate a multi-step form and checkout flow using the real endpoints from the API.

How it works

The Computer Use API works in a loop. You capture a screenshot, send it to the vision endpoint, and the model returns actions such as click, type, or scroll. You repeat until the status is done. For stateful tasks that span multiple captures, you create a session and use the session predict endpoint. Each capture and action step is billed at $0.05. When your automation must follow the user’s view, this approach gives you reliable behavior without brittle selectors.

bash
curl -X POST https://coasty.ai/v1/predict \
  -H "X-API-Key: $COASTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "cua_version": "v4",
    "image": "BASE64_SCREENSHOT",
    "instruction": "Find the first name field, type John Doe, then click the submit button."
  }'

Key endpoints for form and checkout automation

  • POST /v1/predict captures the screen, sends a screenshot, instruction, and cua_version, and returns actions and a status.
  • POST /v1/sessions creates a stateful trajectory for multi-step flows and lets you call POST /v1/sessions/{id}/predict for continuous interaction.
  • POST /v1/runs submits a task to an agent that drives the user flow until success or failure, with states queued, running, succeeded, failed, cancelled, or timed_out.
  • POST /v1/workflows defines a versioned JSON DSL with task steps, asserts, loops, and parallel branches for complex checkout sequences.
  • POST /v1/machines provisions a cloud VM that the agent controls, enabling real desktop and browser automation.
  • Billing is prepaid USD at $0.01 per credit, with $0.05 per agent step for task runs and $0.05 per task step in workflows.
  • Rate limits are enforced with 429 and rate-limit headers; provide an Idempotency-Key header for safe retries.

Loop capture, predict, and act until status is done, and create a session for stateful multi-step flows.

Where this beats brittle automation

Static selectors and XPath break when layouts change, when elements shift, or when dynamic classes appear. The Computer Use API does not rely on stable identifiers. It sees the screen content and understands context. It can handle CAPTCHAs, dynamic text, and overlay elements. It also works across browsers, desktop apps, and terminals when you provision machines. This makes it ideal for checkout flows that include address auto-complete, price updates, and dynamic promotion banners.

You can now automate multi-step forms and checkout flows without brittle selectors. Start by creating a session, capturing screenshots, and sending instructions to the vision endpoint. Use workflow DSLs for complex sequences, and provision machines for real desktop or browser control. Visit https://coasty.ai/developers to get your API key and build reliable automation at $0.05 per agent step.

Want to see this in action?

View Case Studies
Try Coasty Free