Back to Blog
Tutorial

James Liu12 min
Ctrl+R

Writing selectors for every button, menu, and modal is fragile. Apps update, and your scripts break. The Coasty computer use API lets you give an agent instructions in plain language and watch it complete tasks on your desktop, browser, or terminal. Instead of maintaining selectors, you describe what you want to see and do. The agent reads the screen, decides the next step, and acts. This guide shows how to use the Coasty computer use API to automate any desktop app.

How it works

You start a Task Run with a POST /v1/runs request. The body includes a machine_id, a task description (what to do), and optional instructions. You can also set max_steps, deadline_seconds, and a webhook_url to receive results. Coasty provisions a cloud VM and starts an agent. The agent takes screenshots, predicts actions, and executes them until the task succeeds, fails, or times out. You are billed $0.05 per agent step. You can check the run status with GET /v1/runs, stream events with GET /v1/runs/{id}/events, cancel with POST /v1/runs/{id}/cancel, or resume with POST /v1/runs/{id}/resume. For fully autonomous work, use cua_version "v4" with a pass/fail verifier.

bash
curl https://coasty.ai/v1/runs \
  -H "X-API-Key: $COASTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "machine_id": "$MACHINE_ID",
    "task": "open https://example.com and click the first link",
    "cua_version": "v3",
    "max_steps": 50,
    "deadline_seconds": 300,
    "on_awaiting_human": "pause"
  }'

Key request and response fields

  • machine_id: required string, a cloud VM provisioned by Coasty.
  • task: required string, a natural-language description of the goal.
  • cua_version: string, "v3" for guided runs, "v4" for autonomous with verifier.
  • instructions: optional string, appended to the base prompt.
  • system_prompt: optional string, overrides the default system prompt.
  • max_steps: integer, maximum agent steps before a run stops.
  • deadline_seconds: integer, time limit in seconds.
  • on_awaiting_human: string, one of "pause", "fail", or "cancel".
  • webhook_url: optional string, endpoint to receive run events.
  • status: one of queued, running, awaiting_human, succeeded, failed, cancelled, timed_out.

Billed $0.05 per agent step. Use max_steps and deadline_seconds to control costs and timeouts.

Where this beats brittle automation

Traditional automation relies on CSS selectors, IDs, or XPath. When a UI changes, your script fails. The Coasty computer use API lets the agent see the screen and reason about what to do. It can handle menus, pop-ups, dynamic layouts, and multi-step workflows without explicit selectors. You focus on describing what you want, not how the UI is structured. This makes your automation more resilient to updates and easier to maintain.

Next steps

  • Get a key at https://coasty.ai/developers and set COASTY_API_KEY.
  • Provision a machine with POST /v1/machines and save its machine_id.
  • Start a run with POST /v1/runs and monitor with GET /v1/runs/{id}/events.
  • For autonomous workflows, use cua_version "v4" and provide a pass/fail verifier.
  • Explore workflows with POST /v1/workflows for complex, multi-step pipelines.
  • Integrate Coasty into your codebase and build agents that drive browsers, desktops, and terminals.

You now have a concrete way to automate any desktop app with the Coasty computer use API. Describe your goal in natural language, let the agent see and act, and get billed only for successful steps. Stop fighting selectors and start building reliable automation. Get your key at https://coasty.ai/developers and try it today.

© 2026 Coasty

Backed byYCombinator