Tutorial

Provision Cloud Machines on Demand with the /v1/machines API

James Liu||5 min
Del

Most computer use agents run against a single local machine or a static cloud VM. That limits what you can test. You cannot spin up a fresh desktop, browser, or terminal for every run without manual setup. The /v1/machines endpoint solves that. It provisions a cloud VM you can start, stop, and snapshot. Your computer use agent can then drive the real OS, browsers, and terminals. This enables repeatable end-to-end testing, multi-session workflows, and environments that mirror production.

How /v1/machines works

You POST to /v1/machines with a machine_id and the machine_type you need. The endpoint returns a machine object with id, status, and a URL to access the desktop via VNC. The status transitions from queued to running. Once status is running you use the VNC URL to connect your computer use agent via /v1/runs. You can stop the machine with a PATCH or DELETE operation, and snapshot it for later reuse. This flow lets you treat machines as disposable resources for each task run.

bash
curl -X POST https://coasty.ai/v1/machines \
  -H "X-API-Key: $COASTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "machine_id": "prod-desktop-001",
    "machine_type": "desktop"
  }'

# Response
{
  "machine_id": "prod-desktop-001",
  "status": "running",
  "vnc_url": "wss://coasty.ai/v1/machines/prod-desktop-001/vnc",
  "created_at": "2025-06-23T12:00:00Z"
}

Key fields and operations

  • machine_id: a unique identifier for the machine (provided by you or generated by the API).
  • machine_type: the type of desktop environment (desktop, browser, terminal).
  • status: one of queued, running, stopped, failed.
  • vnc_url: a WebSocket URL your computer use agent can use to interact with the desktop.
  • Start a machine with POST /v1/machines.
  • Stop a machine by PATCH or DELETE to /v1/machines/{id}.
  • Snapshot a machine to reuse its state in later runs.

POST /v1/machines with machine_id and machine_type to start a cloud desktop, then use the returned vnc_url in your computer use agent.

Where this beats brittle automation

Traditional automation relies on brittle selectors, hardcoded IDs, and API-only tools. If a DOM element changes or an API endpoint moves, your tests break. The /v1/machines endpoint gives you a real desktop environment. Your computer use agent can see the screen, navigate menus, fill forms, and click buttons exactly as a human would. This makes your automation resilient to UI changes and allows you to test full workflows including browser interactions, system settings, and terminal commands. You are not just clicking selectors you are using computer use agents on real machines.

Now you can spin up fresh cloud desktops for every task run, drive them with a computer use agent, and stop them when done. Build multi-session workflows, end-to-end test suites, and environments that mirror production. Get a key at https://coasty.ai/developers and start provisioning machines on demand.

Want to see this in action?

View Case Studies
Try Coasty Free