Back to Blog
Guide

Rachel Kim7 min
+K

You have a legacy desktop app, a custom internal tool, or a browser-based workflow that lacks an official API. Traditional automation tools rely on selectors, XPath, or undocumented endpoints that break with the next UI update. You need an approach that works on the actual screen. The Coasty computer use API lets you drive real desktops, browsers, and terminals as if a human user is at the keyboard and mouse. You define the task once and let the agent handle the rest, across Windows, macOS, and Linux.

Understand the task run model

The core primitive for automating with Coasty is a task run. You submit a POST /v1/runs request with a machine_id, a task description, and a cua_version string. The cua_version defaults to v3 for a guided agent, or you can set v4 for an autonomous agent with a pass/fail verifier. You can optionally provide instructions to append to the base prompt, a system_prompt, a max_steps cap, a deadline_seconds limit, and an on_awaiting_human strategy (pause, fail, or cancel). When the run begins, the agent uses a real desktop to execute the task step by step. Each agent step costs $0.05. The run progresses through states such as queued, running, awaiting_human, succeeded, failed, cancelled, or timed_out. You can poll GET /v1/runs, get detailed status with GET /v1/runs/{id}, cancel with POST /v1/runs/{id}/cancel, or resume with POST /v1/runs/{id}/resume. For streaming progress, use GET /v1/runs/{id}/events and reconnect using the Last-Event-ID header.

bash
curl -X POST https://coasty.ai/v1/runs \
  -H 'X-API-Key: $COASTY_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "machine_id": "machine-123",
    "task": "Open the calculator app on Windows and compute 123 + 456",
    "cua_version": "v3",
    "max_steps": 10,
    "deadline_seconds": 60,
    "on_awaiting_human": "pause"
  }'

Build workflows for multi-step tasks

When automation involves multiple stages, define a workflow as a versioned JSON DSL. Submit POST /v1/workflows to create a new workflow, then POST /v1/workflows/{id}/runs or POST /v1/workflows/runs to execute it. A workflow is a sequence of step types: task, assert, if, loop, parallel, human_approval, retry, succeed, and fail.Each step can reference variables using double-brace syntax like {{ inputs.username }} or by a step ID such as stepId.field. You can enforce guards like budget_cents, max_iterations, and deadline_seconds at the workflow or per step level. Task steps are billed $0.05 each, and the workflow engine drives the agent through the sequence while tracking variables and conditionals. This gives you a reusable, auditable automation pipeline without hardcoding UI selectors.

Work with stateful sessions and vision

For tasks that require long-running context, use sessions for stateful trajectory memory. Create a session with POST /v1/sessions, then call POST /v1/sessions/{id}/predict repeatedly. For vision-based element targeting, POST /v1/ground with a base64 screenshot and an element description to get x,y coordinates. You can also use the free POST /v1/parse endpoint to convert pyautogui code into structured actions. These primitives let you combine screen-aware targeting with precise control, useful for form filling, data entry, or complex multi-window workflows.

One task run per goal, billed $0.05 per agent step, and workflows to chain runs for complex flows.

Where this beats brittle automation

Selector-based tools break when classes, IDs, or nested structures change. API-only tools require official endpoints that often do not exist. Coasty computer use agents interact with the actual UI on a real desktop. They can handle dynamic menus, fuzzy buttons, or multi-step wizards without explicit selectors. The model sees the screen and chooses the right elements, making your automations robust across versions and platforms. You also get built-in human approval hooks, retry logic, and streaming progress through webhooks and events, so you can react to pauses or errors in real time.

Stop building brittle selectors and start driving real desktops with Coasty. You can create reliable task runners, multi-step workflows, and autonomous agents that work on any OS and any UI. Get your API key at https://coasty.ai/developers and try your first task run today.

© 2026 Coasty

Backed byYCombinator