Back to Blog
Tutorial

Marcus Sterling6 min
⌘+B

Building a robust computer use agent often means you need more than just an API. You need a live desktop, a browser, or a terminal to actually interact with. Manually provisioning and managing those environments is tedious and error-prone. The /v1/machines endpoint eliminates that friction. It lets you provision cloud machines on demand, start, stop, and snapshot them, and hand them off directly to a computer use agent. This guide shows the exact fields you send and how to build a workflow that spins up a machine, runs a task, and tears it down.

How it works

Provisioning a machine is a two-step process on the /v1/machines endpoint. First, you POST to /v1/machines with a machine_id, machine_type, and optional parameters like os, cpu_count, memory_mb, and disk_gb. The API returns a machine object with an id, status, and a public_ip. You can then start the machine with a start request. The agent drives this real environment just like a human would, using screenshots and actions rather than brittle selectors.

bash
#!/bin/bash

COASTY_API_KEY="${COASTY_API_KEY}"
BASE_URL="https://coasty.ai/v1"

# 1. Provision a cloud machine
PROVISION_RESPONSE=$(curl -s -X POST "${BASE_URL}/machines" \
  -H "X-API-Key: ${COASTY_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{
    "machine_id": "demo-mac-001",
    "machine_type": "cloud-desktop",
    "os": "windows-11",
    "cpu_count": 2,
    "memory_mb": 4096,
    "disk_gb": 80
  }')

echo "Provision response: ${PROVISION_RESPONSE}"

# 2. Start the machine
MACHINE_ID=$(echo $PROVISION_RESPONSE | jq -r '.id')
START_RESPONSE=$(curl -s -X POST "${BASE_URL}/machines/${MACHINE_ID}/start" \
  -H "X-API-Key: ${COASTY_API_KEY}" \
  -H "Content-Type: application/json")

echo "Start response: ${START_RESPONSE}"
echo "Machine ID: ${MACHINE_ID}"

# 3. Optionally, snapshot the machine
SNAPSHOT_RESPONSE=$(curl -s -X POST "${BASE_URL}/machines/${MACHINE_ID}/snapshot" \
  -H "X-API-Key: ${COASTY_API_KEY}" \
  -H "Content-Type: application/json")

echo "Snapshot response: ${SNAPSHOT_RESPONSE}"

# 4. Stop the machine when done
STOP_RESPONSE=$(curl -s -X POST "${BASE_URL}/machines/${MACHINE_ID}/stop" \
  -H "X-API-Key: ${COASTY_API_KEY}" \
  -H "Content-Type: application/json")

echo "Stop response: ${STOP_RESPONSE}"

Key fields and costs

  • machine_id: a unique identifier for this machine (required).
  • machine_type: the type of machine to provision (required).
  • os: the operating system (optional).
  • cpu_count: number of CPUs (optional).
  • memory_mb: memory size in megabytes (optional).
  • disk_gb: disk size in gigabytes (optional).
  • GET /v1/machines and GET /v1/machines/{id} list machines and show status.
  • POST /v1/machines/{id}/start brings a machine online.
  • POST /v1/machines/{id}/stop powers off a machine.
  • POST /v1/machines/{id}/snapshot creates a snapshot of the machine state.

Use /v1/machines for dynamic, human-like environments where your computer use agent can see and act like a real user.

Where this beats brittle automation

Traditional automation often relies on fixed selectors or API endpoints that change. When an element is hidden, a layout shifts, or a site adds a capcha, your script breaks. A computer use agent that can see the screen and act like a human works around those issues. By provisioning a real desktop, your agent can open browsers, click buttons, fill forms, and navigate just as you would. This is especially valuable for workflows that depend on visual cues, drag-and-drop, or multi-step processes that are hard to model with selectors alone.

You now know how to provision cloud machines on demand with the /v1/machines API. Combine this with task runs or workflows to create powerful automation pipelines that spin up an environment, run complex tasks, and clean up. Start building with real desktops at https://coasty.ai/developers to get your API key.

© 2026 Coasty

Backed byYCombinator