Guide

From Prototype to Production with the Coasty Computer Use API

Sarah Chen||10 min
Pg Up

You have a script that clicks a button in a browser. It works on your laptop but fails when the UI layout changes or when the window is off-screen. The Coasty computer use API lets you drive real desktops, browsers, and terminals using action steps that mimic human behavior. This guide shows how to move from a prototype to a production system using real Coasty endpoints, pricing, and workflow DSL.

Core concepts

  • POST /v1/runs provisions a cloud machine and runs an autonomous agent until success, failure, or cancellation.
  • Each agent step costs $0.05 and the task run is billed per step.
  • You can monitor progress with GET /v1/runs/{id}/events which streams Server-Sent Events.
  • POST /v1/workflows lets you define a versioned JSON DSL with tasks, asserts, loops, and hard guards.
  • POST /v1/machines provisions a cloud VM you can start, stop, and snapshot for reproducible environments.
  • Webhooks are available to notify your system of run state changes, signed with Coasty-Signature.
  • An HMAC idempotency header protects against retries on write operations.

How it works

  • Create a machine with POST /v1/machines (machine_id returned).
  • Create a task run with POST /v1/runs specifying machine_id, task, and cua_version (v3 or v4).
  • Poll GET /v1/runs/{id} for terminal state (queued, running, succeeded, failed, cancelled, timed_out).
  • Stream events from GET /v1/runs/{id}/events to show progress to users. Reconnect with Last-Event-ID.
  • If the run requires human input, set on_awaiting_human to pause, fail, or cancel.
  • Use workflows for multi-step pipelines with tasks, asserts, and hard guards like deadline_seconds or max_iterations.
bash
# Build a task run and stream events

export COASTY_API_KEY="$(cat ~/.coasty_key)"

run_id=$(curl -s -X POST https://coasty.ai/v1/runs \
  -H "Authorization: Bearer $COASTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "machine_id": "mach-abc123",
    "task": "Open Chrome and navigate to https://example.com",
    "cua_version": "v4",
    "max_steps": 50,
    "deadline_seconds": 300,
    "on_awaiting_human": "pause"
  }' \
  | jq -r .id)

echo "Run id: $run_id"

# Stream events
curl -s https://coasty.ai/v1/runs/$run_id/events \
  -H "Authorization: Bearer $COASTY_API_KEY" \
  -N | while IFS= read -r line; do
    echo "$line"
  done

POST /v1/runs creates an autonomous agent that drives real machines for $0.05 per step.

Where this beats brittle automation

  • Actions are grounded in screen context, not fixed selectors, so UI changes do not break the run.
  • The agent drives browsers, desktop apps, and terminals directly, not through API wrappers.
  • Workflows provide structured state (tasks, asserts, loops) with hard guards like budget_cents and deadline_seconds.
  • You can provision reproducible cloud machines, stop and snapshot them, and retry runs on the same environment.
  • Webhooks and event streams give you real-time visibility without polling manually.
  • The MCP server lets you drive Coasty from Cursor, Claude Desktop, or other MCP clients.

Next steps

  • Create a workflow that orchestrates multiple tasks with asserts and loops.
  • Integrate a webhook to update your inventory or database when a run succeeds.
  • Use the MCP server to extend existing workflows inside your IDE.
  • Read the full API docs at https://coasty.ai/docs and generate a key at https://coasty.ai/developers.

You now have a blueprint for moving from prototype scripts to production automation that works across real browsers, desktops, and terminals. Build a task runner that provisions machines, runs workflows with hard guards, and streams events to your backend. Get a key at https://coasty.ai/developers and start automating like a human.

Want to see this in action?

View Case Studies
Try Coasty Free