Tutorial

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

Sarah Chen||12 min
Tab

Traditional QA tools rely on brittle selectors, hardcoded wait times, or fragile APIs that break when an app changes layout. You need a bot that sees the screen, clicks like a human, and asserts results. The Coasty Computer Use API gives you that. It provisions a real cloud machine, runs a computer use agent with vision, and executes tasks until success or failure. This guide shows how to build a self-running QA bot that logs in, navigates, and asserts outcomes using the /v1/runs endpoint.

How it works

You start by POSTing to /v1/runs with a machine_id, a task description, and optional parameters. The server provisions a cloud VM, loads a computer use agent (CUA) with cua_version, and executes the task. The agent takes screenshots, interprets them against the instruction, and performs actions like clicks, types, and scrolls. The run emits events via Server-Sent Events, and the total cost is $0.05 per agent step. The bot succeeds when the status becomes succeeded, or fails when the state is failed or timed out.

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-12345",
    "task": "Open https://example.com, click the login link, type [email protected] in the email field, click the submit button, and assert that the homepage title contains "Welcome"",
    "cua_version": "v3",
    "max_steps": 20,
    "on_awaiting_human": "pause"
  }'

Key parameters for QA runs

  • machine_id: ID of a cloud VM that the agent drives
  • task: natural language instruction describing the QA sequence
  • cua_version: v3 (guided) or v4 (autonomous with pass/fail verifier)
  • max_steps: cap on agent steps to prevent runaway tests
  • deadline_seconds: wall-clock timeout for the run
  • on_awaiting_human: pause, fail, or cancel when the agent needs human input
  • webhook_url: optional endpoint to receive run state updates
  • system_prompt: optional system-level instructions appended to the base prompt

Each agent step costs $0.05, and the server bills from a prepaid USD wallet where 1 credit equals $0.01.

Where this beats brittle automation

Traditional tools rely on CSS selectors that break when an app changes class names or DOM structure. The computer use agent sees the actual rendered screen, reads button labels, and clicks based on visual context. It can handle dynamic UIs, pop-ups, and modal dialogs without extra selectors. It also runs on real browsers and desktops, not just headless mocks, giving you accurate end-to-end test coverage. You can also use the free /v1/parse endpoint to turn pyautogui code into structured actions, or the $0.03 /v1/ground endpoint to map screenshots to coordinates for precise targeting.

You now have a blueprint for a self-running QA bot using the Coasty Computer Use API. Next, integrate the run lifecycle into your CI/CD pipeline, add webhook handlers for status updates, and explore workflows to orchestrate complex test suites. Get your API key at https://coasty.ai/developers to start building.

Want to see this in action?

View Case Studies
Try Coasty Free