Back to Blog
Tutorial

James Liu6 min
⌘+D

Most desktop automation today requires brittle selectors or fragile APIs that break when an app changes. You want an agent that can see the screen, click, type, and navigate just like a human. The Coasty Computer Use API gives you that with the /v1/runs endpoint. You send a task string and configuration, and the server drives a real machine to completion. No selectors. No manual coding of every click. The agent handles the UI, adapts to changes, and returns a final status and events stream.

How Coasty Task Runs Work

A task run is a single HTTP POST to /v1/runs. You provide a machine_id to target a cloud desktop, a task string describing what to do, and optional parameters. The request body looks like this. { "machine_id": "your-cloud-machine-id", "task": "Install the latest Chrome browser, then open the home page and take a screenshot", "cua_version": "v4", "instructions": "Use the official installer and keep the window open after installation.", "max_steps": 200, "deadline_seconds": 300, "on_awaiting_human": "pause", "webhook_url": "https://your-domain.com/coasty-hook" } The server returns a run_id immediately. You can poll GET /v1/runs/{id} or stream events with GET /v1/runs/{id}/events. The state transitions through queued, running, awaiting_human, succeeded, failed, cancelled, or timed_out. Each agent step is billed $0.05.

bash
curl -X POST https://coasty.ai/v1/runs \
  -H "X-API-Key: $COASTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "machine_id": "your-cloud-machine-id",
    "task": "Install the latest Chrome browser, then open the home page",
    "cua_version": "v4",
    "max_steps": 200,
    "deadline_seconds": 300,
    "on_awaiting_human": "pause",
    "webhook_url": "https://your-domain.com/coasty-hook"
  }'

State Machine and Event Stream

  • queued: run accepted, waiting for a machine
  • running: agent is executing steps on the machine
  • awaiting_human: agent paused for manual approval
  • succeeded: all steps completed without failure
  • failed: agent encountered an unrecoverable error
  • cancelled: run stopped by you or a workflow
  • timed_out: deadline_seconds exceeded
  • GET /v1/runs/{id}/events returns Server-Sent Events to see each step in real time
  • Use Last-Event-ID header to reconnect after a disconnect

One POST to /v1/runs and a GET /v1/runs/{id}/events stream gives you full observability of your autonomous task.

Where Computer Use Beats Brittle Automation

Traditional automation relies on fixed selectors, XPath, or UI element IDs. When a UI changes or an app updates, your scripts break and need constant maintenance. The Coasty computer use agent drives real desktops and browsers. It sees the screen as a human does, reads text, identifies buttons, and clicks. If an element moves or an error message changes, the agent adapts. You don’t need to predict every UI layout. You only need to describe the task in plain language. This makes workflows resilient to changes and reduces maintenance overhead dramatically.

Start building autonomous agents that control real desktops and browsers with a single API call. Use /v1/runs to orchestrate complex workflows, monitor progress via the events stream, and pay per step. Read the full docs and get your API key at https://coasty.ai/developers.

© 2026 Coasty

Backed byYCombinator