Tutorial

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

Marcus Sterling||6 min
F5

Most automation stacks rely on pre-provisioned machines or fragile CSS selectors. If the UI changes, the script breaks. The /v1/machines endpoint removes that friction. You provision a cloud VM on demand, then hand it to a computer use agent that sees the screen and clicks like a human. This lets you build automated workflows that survive UI changes and work on real browsers, terminals, and desktop apps.

How provisioning works

Provisioning is a two-step process. First, create a cloud machine with POST /v1/machines. The request includes a machine_id, a task (the agent's objective), and a cua_version string like "v3" or "v4". The response gives you the machine id, its current state, and any ephemeral credentials or URLs. Once the machine is running, you can start a task run with POST /v1/runs, which bills $0.05 per agent step. The server drives the agent to completion or until it hits a timeout or budget.

bash
curl -X POST https://coasty.ai/v1/machines \ 
  -H "X-API-Key: $COASTY_API_KEY" \ 
  -H "Content-Type: application/json" \ 
  -d '{
    "machine_id": "demo-machine",
    "task": "Open https://example.com and take a screenshot of the page",
    "cua_version": "v3"
  }'

# Response (simplified)
# {
#   "machine_id": "demo-machine",
#   "state": "running",
#   "url": "https://coasty.ai/cloud/desktop/demo-machine",
#   "ephemeral_credentials": {"username": "agent", "password": "****"}
# }

Key fields and billing

  • machine_id: a unique identifier for your cloud VM.
  • task: the agent's objective, expressed in plain English.
  • cua_version: "v3" for guided mode, "v4" for autonomous mode with a pass/fail verifier.
  • POST /v1/runs bills $0.05 per agent step.
  • POST /v1/machines does not generate a direct charge in the facts provided.
  • States include queued, running, awaiting_human, succeeded, failed, cancelled, timed_out.

Provision a cloud VM and hand it to a computer use agent. Each agent step costs $0.05.

Where this beats brittle automation

CSS selectors break when layouts shift or frameworks change. API-only tools miss hidden or dynamically rendered elements. A computer use agent sees the screen, interprets instructions, and clicks or types like a human. This makes workflows resilient to UI changes. You can drive real browsers, terminals, and desktop apps instead of mocking them. The /v1/machines endpoint ensures you always have a fresh, secure environment for every run.

Start provisioning cloud machines on demand with the /v1/machines endpoint. Build end-to-end workflows that work on real browsers, terminals, and desktops. Get your API key at https://coasty.ai/developers.

Want to see this in action?

View Case Studies
Try Coasty Free