Tutorial

Build a Self-Running QA Testing Bot with the Computer Use API

Lisa Chen||8 min
Pg Up

Traditional end-to-end tests rely on brittle selectors and APIs that may not exist or change often. The Coasty Computer Use API lets you build a QA bot that sees the screen and acts like a human. It captures screenshots, interprets UI, and clicks, types, and scrolls just like a real tester. This tutorial shows you how to wire up a self-running QA test using the Task Runs endpoint and a simple Python driver.

How it works

You submit a task to POST /v1/runs with a machine_id, the test description, the CUA version, and options like max_steps and deadline_seconds. The server provisions a machine, launches an agent, and streams events back via GET /v1/runs/{id}/events. Each agent step costs $0.05. When the agent succeeds, fails, or times out, you get a final status. This model lets you orchestrate a multi-step QA workflow without writing a custom driver loop.

bash
curl https://coasty.ai/v1/runs \
  -X POST \
  -H "X-API-Key: $COASTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "machine_id": "my-test-machine",
    "task": "Navigate to https://example.com, verify the H1 title says "Welcome", click the "Sign In" link, and then click the "Continue with Email" button.",
    "cua_version": "v4",
    "max_steps": 100,
    "deadline_seconds": 600,
    "on_awaiting_human": "pause"
  }'

Next, stream events

  • Use GET /v1/runs/{id} to poll for the final status until it is no longer "running".
  • GET /v1/runs/{id}/events streams Server-Sent Events. Reconnect with the Last-Event-ID header.
  • Each event contains a timestamp, status (queued, running, awaiting_human, succeeded, failed, cancelled, timed_out), and sometimes a step summary.
  • The final status tells you if the test passed, failed, or was cancelled.

Each agent step costs $0.05, so set max_steps to keep costs predictable.

Where this beats brittle automation

Selector-based tools require you to maintain stable CSS/XPath selectors that break when the UI changes. The Computer Use API lets the agent see the actual UI and reason about it. It can handle dynamic text, hidden elements, and reflowed layouts without you writing brittle selectors. You also get a human-like simulation of scrolling, typing, and navigation, which uncovers usability issues that pure API calls miss.

You now have a simple foundation for a self-running QA bot. Extend it by using workflow steps for multi-page flows, adding assertions between steps, and wiring webhook notifications for test results. Ready to try it yourself? Get an API key at https://coasty.ai/developers and start automating your QA process with the Computer Use API.

Want to see this in action?

View Case Studies
Try Coasty Free