Back to Blog
Tutorial

Emily Watson12 min
Pg Up

Traditional QA automation relies on fragile selectors, brittle XPath, and brittle waits. You end up maintaining a tangled library of selectors for every change. A computer use agent can see the screen, understand context, and act like a human tester. You define a task, let the agent run on a cloud machine, and receive a pass/fail result via an event stream. This guide shows how to build a self-running QA bot with the real endpoints and pricing from the Coasty Computer Use API.

How it works

The flow consists of three steps. First, provision a cloud machine that the agent will drive. Then create a task run with a base prompt that tells the agent to navigate to an application, perform actions, and assert results. The server runs an autonomous agent on that machine and streams events. You get a final status of succeeded or failed. The endpoint for this is POST /v1/runs. You provide machine_id, task, cua_version, optional instructions, and an optional webhook_url. The agent steps through UI actions, and every step on a task costs $0.05. The final status is sent to your webhook if provided.

bash
# 1. Provision a cloud machine for the QA bot
# Replace <YOUR_MACHINE_ID> with the actual ID from a previous POST /v1/machines call
MACHINE_ID="<YOUR_MACHINE_ID>"

# 2. Create a self-running QA run
# The task drives a browser test on the machine.
# We use cua_version "v4" for autonomous execution with built-in pass/fail verification.
curl -X POST https://coasty.ai/v1/runs \
  -H "Authorization: Bearer $COASTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d "/**
  "machine_id": "$MACHINE_ID",
  "task": "Navigate to https://example.com, find the search input, type 'Coasty QA bot', press Enter, then assert that the page title includes 'Coasty'.",
  "cua_version": "v4",
  "max_steps": 100,
  "deadline_seconds": 300,
  "on_awaiting_human": "pause"
}"

# The response includes the run_id. Use it to poll or stream events.

# 3. Stream run events to monitor progress
# Reconnect with Last-Event-ID on failure.
curl -X GET "https://coasty.ai/v1/runs/{run_id}/events" \
  -H "Authorization: Bearer $COASTY_API_KEY" \
  --no-buffer

# 4. Cancel the run if needed
# curl -X POST https://coasty.ai/v1/runs/{run_id}/cancel \
#   -H "Authorization: Bearer $COASTY_API_KEY"

Key fields and pricing

  • POST /v1/runs requires machine_id, task, and cua_version (v4 recommended).
  • Optional instructions get appended to the base prompt.
  • on_awaiting_human can be pause, fail, or cancel when the agent needs human input.
  • max_steps limits the number of agent steps. Each task step costs $0.05.
  • deadline_seconds caps the total run duration.
  • webhook_url receives a final status and event payload when configured.
  • GET /v1/runs/{id} returns the run state (queued, running, awaiting_human, succeeded, failed, cancelled, timed_out).
  • GET /v1/runs/{id}/events streams Server-Sent Events. Reconnect with Last-Event-ID on failure.
  • POST /v1/runs/{id}/cancel stops the agent mid-run.
  • POST /v1/runs/{id}/resume continues a paused run.

Every task step on a run costs $0.05, and the final run state is returned via stream events.

Where this beats brittle automation

A purely API-based automation tool requires you to know every internal endpoint, every query parameter, and every possible response variation. You write brittle selectors for elements that may change class names, IDs, or structure. A computer use agent sees the screen, understands context, and can adapt to layout changes. It can click buttons, fill forms, and interpret dynamic content without brittle selectors. This makes your QA bot more resilient and easier to maintain. You focus on the test intent, not the UI implementation details.

With a machine, a task, and the /v1/runs endpoint, you can build a self-running QA bot that drives real browsers and validates results. Use the event stream to monitor progress and receive final status. Start building your autonomous QA tester today at https://coasty.ai/developers.

© 2026 Coasty

Backed byYCombinator