Back to Blog
Tutorial

Sophia Martinez8 min
⌘+Z

Desktop automation often means writing fragile selectors, keeping up with UI changes, and maintaining endless boilerplate. The Coasty computer use API changes that. It treats your target app as a real screen and a real keyboard. You give it a screenshot, an instruction, and it decides which keys to press and where to click. This is computer use in action. You get a vision model that sees the screen, an agent that plans actions, and a full-stack API that drives real machines. No fake DOM trees. No brittle XPaths. You just describe the goal and let the agent do the work.

How it works

The core loop is simple. The server maintains a real desktop session. At each step it takes a base64 screenshot, sends it to the vision model with your instruction, and receives a list of actions (mouse clicks, key presses, text edits). The server then executes those actions, updates the screen state, and repeats. You can interact with this loop two ways. The low‑level API lets you build your own agent. The high‑level task run API lets you offload the whole job to a server‑driven agent. Both use the same vision and action pipeline under the hood.

bash
# Example: submit a task run that opens a browser and fills a form.
# 1. Create a Task Run
#    POST https://coasty.ai/v1/runs
#    Uses the server‑driven agent (cua_version: v4)
#    Billed $0.05 per agent step.

API_KEY=$(cat "$HOME/.coasty_api_key")

curl -s -X POST https://coasty.ai/v1/runs \
  -H "X-API-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "machine_id": "machine-123",
    "task": "Open Chrome, go to https://example.com, and type Hello into the search box.",
    "cua_version": "v4",
    "max_steps": 100,
    "deadline_seconds": 300,
    "on_awaiting_human": "pause"
  }' | jq .

Step-by-step: create a task run

  • POST https://coasty.ai/v1/runs creates a task run.
  • Required fields: machine_id, task, cua_version.
  • cua_version: v3 for guided mode, v4 for autonomous with pass/fail verifier.
  • max_steps: how many agent steps to allow (billed $0.05 each).
  • deadline_seconds: how long the run can live.
  • on_awaiting_human: pause, fail, or cancel if the agent asks for human help.
  • Returns a run ID that you can use to poll or stream events.

POST /v1/runs creates a server-driven agent that receives screenshots, plans actions, and executes them until the task succeeds, fails, or times out.

Where this beats brittle automation

Traditional automation tools rely on stable selectors, fixed class names, or hard‑coded element IDs. When a UI changes, the script breaks, and you spend hours debugging. With the Coasty computer use API, the agent sees the screen every step. It can adapt to layout shifts, new icons, or missing elements because it’s operating on pixels and keyboard events directly. This approach reduces maintenance dramatically. You describe the intent, not the implementation. The agent handles the details of finding the right controls, handling multiple windows, and recovering from unexpected states.

Next steps

Start small. Submit a task run to open a browser and perform a simple action. Then move to longer workflows, use webhooks to get real-time status, and finally integrate the API into your CI/CD pipelines or internal tools. If you want finer control, build your own agent around the vision and action APIs. For IDE integration, the MCP server lets you drive Coasty directly from Cursor, Claude Desktop, or other MCP clients. The key decision is whether you want the server to handle the full agent loop or you want to orchestrate it yourself. Either way, you are automating real desktops with a computer use API that sees and acts like a human.

Stop wrestling with brittle selectors. Use the Coasty computer use API to automate any desktop app with vision, action, and real machines. Get your API key and start building at https://coasty.ai/developers.

© 2026 Coasty

Backed byYCombinator