Provision Cloud Machines on Demand with the Coasty /v1/machines API
Building automation that survives UI changes requires real machines, not stubs. The Coasty /v1/machines API provisions cloud VMs on demand. You can start fresh desktops, browsers, or terminals for each task run. The agent drives these real environments, using vision to see what is on screen and acting like a human. This approach eliminates brittle selectors and keeps your workflow resilient.
How /v1/machines works
You send a POST to https://coasty.ai/v1/machines with a JSON payload. The API returns a machine_id, status, and creation time. You can start the machine with GET /v1/machines/{id}/start or stop it with stop. Machines persist until you delete them, so you can reuse them across multiple task runs. This flow lets you spin up isolated environments for every execution.
#!/bin/bash
# Set your API key from the environment
COASTY_API_KEY=${COASTY_API_KEY}
# Provision a cloud machine
RESPONSE=$(curl -s -X POST https://coasty.ai/v1/machines \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"os": "windows-11",
"browser": true,
"terminal": true
}')
# Extract the machine_id from the response
MACHINE_ID=$(echo $RESPONSE | jq -r '.machine_id')
echo "Provisioned machine_id: $MACHINE_ID"
# Start the machine
START_RESPONSE=$(curl -s -X GET "https://coasty.ai/v1/machines/$MACHINE_ID/start" \
-H "X-API-Key: $COASTY_API_KEY")
echo "Start response: $START_RESPONSE"
# Example: run a task on this machine using a task run
RUN_RESPONSE=$(curl -s -X POST https://coasty.ai/v1/runs \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"machine_id": "'$MACHINE_ID'",
"task": "open https://coasty.ai and take a screenshot",
"cua_version": "v3"
}')
echo "Task run response: $RUN_RESPONSE"Key fields and lifecycle
- ●POST /v1/machines creates a new VM with os, browser, and terminal flags.
- ●RESPONSE contains machine_id, status, and creation_time.
- ●GET /v1/machines/{id} returns the current status and details.
- ●GET /v1/machines/{id}/start brings the machine online.
- ●GET /v1/machines/{id}/stop pauses the machine.
- ●Machines remain available until you explicitly delete them.
POST /v1/machines returns machine_id and status; start the machine with GET /v1/machines/{id}/start.
Where this beats brittle automation
Traditional automation relies on stable CSS selectors, XPath, or hardcoded IDs. When UIs change, scripts break. With Coasty you provision a real machine and run a computer use agent. The agent sees the current screen state, interprets instructions, and executes actions through a window manager. This self-healing approach lets the agent navigate to elements even if their selectors change, because it uses vision and natural language to understand the layout.
You can now spin up fresh desktops and browsers for every task run. Build resilient agents that adapt to UI changes and see the screen as a human would. Get your API key at https://coasty.ai/developers and start provisioning machines on demand.