Tutorial

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

Michael Rodriguez||5 min
Pg Up

Most computer use agents live inside a sandbox. They have no view of a real desktop and cannot interact with native UI elements. You end up writing brittle selectors or wrapping unworkable APIs. The /v1/machines endpoint solves this by letting you provision actual cloud VMs that the agent can drive with full screen access. You get a real desktop, a real browser, or a real terminal in under a second. The agent can see what you see and click what you click.

How it works

You send a POST request to /v1/machines with a machine_id and a type. The server creates a cloud VM and returns a machine object with status and connection details. You can start, stop, and snapshot that machine at any time. The agent then runs a task run on that machine, sending screenshots and receiving actions in a stateful loop.

bash
#!/usr/bin/env bash

COASTY_API_KEY="${COASTY_API_KEY}"

# Provision a cloud machine
curl -s https://coasty.ai/v1/machines \
  -H "X-API-Key: ${COASTY_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "machine_id": "my-agent-desktop",
    "type": "desktop"
  }' | jq .

Request and response fields

  • machine_id: a unique identifier you choose for the VM.
  • type: one of desktop, browser, or terminal. You pick the environment the agent will use.
  • status: created, ready, or error.
  • wait_secs: how long to wait for the VM to be ready (default 30).
  • billing: each machine provision event is billed separately.

Spin a machine, run a task on it, and tear it down when you are done.

Where this beats brittle automation

API-only tools rely on stable, documented endpoints. Anything that changes UI layout, class names, or element IDs breaks your script instantly. With a machine, the agent sees the same screen you see. It clicks buttons, types into text fields, and navigates menus exactly like a human. You do not need to maintain a catalog of selectors. You do not need to wrap undocumented APIs. You just describe what to do and let the agent use the real interface.

Integrating with task runs

Once a machine is ready, you submit a task run to that machine. The run uses the same /v1/runs endpoint but you supply the machine_id you just created. The agent will connect to that VM, capture screenshots, send instructions, and execute actions. Task runs are billed $0.05 per agent step. You can cancel or resume runs at any time. You can also stream events with GET /v1/runs/{id}/events to watch progress in real time.

You now have a real desktop, browser, or terminal under your control. Build agents that handle complex workflows, legacy apps, and dynamic interfaces without brittle selectors. Get your API key at https://coasty.ai/developers and start provisioning machines today.

Want to see this in action?

View Case Studies
Try Coasty Free