Tutorial

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

Marcus Sterling||6 min
Ctrl+H

Traditional test automation relies on hardcoded selectors that break when UI changes. The Coasty Computer Use API lets you build a self-running QA bot that logs in, navigates, clicks, and verifies results using actual screen interactions. It uses a Task Run to drive a real desktop, browser, or terminal, streams events in real time, and stops when it succeeds or fails. You pay $0.05 per agent step, and you can pause or resume runs on demand.

How it works

You start a Task Run with a POST /v1/runs request that includes a machine_id, the task description, and a cua_version. The default is v3. For autonomous work, you can set cua_version to v4, which uses a pass/fail verifier. You can also add instructions that append to the base prompt, set optional system_prompt, max_steps, deadline_seconds, on_awaiting_human, and a webhook_url. The server starts a cloud VM and sends Server-Sent Events to your webhook until the run reaches a terminal state: queued, running, awaiting_human, succeeded, failed, cancelled, or timed_out. GET /v1/runs and GET /v1/runs/{id} let you poll status, and POST /v1/runs/{id}/cancel or /resume let you control the run.

bash
curl -X POST https://coasty.ai/v1/runs \
  -H "X-API-Key: $COASTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "machine_id": "m-123456",
    "task": "Log in to https://example.com, verify the login success message appears, then navigate to the settings page.",
    "cua_version": "v4",
    "instructions": "User is a QA engineer testing the login flow. Do not close the browser.",
    "max_steps": 50,
    "deadline_seconds": 300,
    "on_awaiting_human": "pause",
    "webhook_url": "https://your-server.com/events"
  }'

Key fields and options

  • machine_id: required, the ID of the cloud VM to drive.
  • task: required, plain language description of what the agent must do.
  • cua_version: optional, default 'v3'. 'v4' for autonomous runs with a pass/fail verifier.
  • instructions: optional, extra context appended to the base prompt.
  • system_prompt: optional, custom system prompt for the agent.
  • max_steps: optional, maximum number of agent steps before the run fails.
  • deadline_seconds: optional, timeout for the entire run.
  • on_awaiting_human: optional, 'pause', 'fail', or 'cancel' when the agent needs user input.
  • webhook_url: optional, where the server sends Server-Sent Events for the run's lifecycle.

POST /v1/runs streams events to your webhook and bills $0.05 per agent step.

Where this beats brittle automation

Traditional test frameworks use CSS selectors or XPath to find elements. When the UI changes, those selectors break, and you need to update tests manually. The Coasty Computer Use API lets your QA bot see the actual screen, understand context from screenshots, and decide where to click and type. It can handle dynamic layouts, hidden UI states, and multi-step flows without needing to maintain a library of precise selectors. Because the agent runs on a real desktop or browser, every test behaves like a real user, giving you more confidence in your quality gates.

Next steps

Extend the bot to run on-demand workflows with POST /v1/workflows, capture screenshots for visual regression, or integrate with your CI pipeline by calling GET /v1/runs and checking for succeeded status. Set up an Idempotency-Key header to make retries safe. Get your API key and start building autonomous QA at https://coasty.ai/developers.

Want to see this in action?

View Case Studies
Try Coasty Free