From Prototype to Production with the Coasty Computer Use API
Writing bots that click buttons and fill forms is easy when HTML is stable. When layouts change, selectors break, and you spend more time fixing selectors than building features. The Coasty Computer Use API solves this by letting your agent see the UI and act like a human. You start with a single task run, then scale to workflows and cloud machines.
How it works
The API gives you two main paths. The first is a task run. You POST /v1/runs with a machine_id, your task, and configuration. The server provisions a machine, starts the agent, and drives it until the task succeeds, fails, or times out. Response includes the run ID and the final status. The second path is sessions and vision. You POST /v1/sessions to create a stateful trajectory. Then call /v1/sessions/{id}/predict with a base64 screenshot, an instruction, and cua_version. The server returns actions. You capture a new screenshot and loop until status is done. There is also /v1/ground to map a description to coordinates, and /v1/parse to convert PyAutoGUI code into structured actions.
curl -X POST https://coasty.ai/v1/runs \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"machine_id": "machine-123",
"task": "Open Chrome, navigate to https://example.com, and click the primary button",
"cua_version": "v4",
"max_steps": 50,
"deadline_seconds": 120,
"on_awaiting_human": "pause"
}'
Key fields and configuration
- ●POST /v1/runs is the entry point for server-driven agents. You must provide machine_id, task, cua_version (default v3, v4 adds a pass/fail verifier), optional instructions (appended to the base prompt), system_prompt, max_steps, deadline_seconds, on_awaiting_human (pause, fail, or cancel), and webhook_url.
- ●GET /v1/runs returns a list of runs. GET /v1/runs/{id} gives the status of a specific run. POST /v1/runs/{id}/cancel stops a running task. POST /v1/runs/{id}/resume continues a paused run.
- ●GET /v1/runs/{id}/events streams Server-Sent Events. Reconnect with the Last-Event-ID header to stay in sync with the agent's actions.
- ●Billing is $0.05 per agent step for task runs. Vision calls are $0.05 for /v1/predict, $0.04 for /v1/sessions/{id}/predict, and $0.03 for /v1/ground. /v1/parse is free. You manage credits in a prepaid USD wallet where 1 credit equals $0.01.
Start with a task run for quick prototypes, then move to sessions and workflows for stateful, reliable production systems.
Where this beats brittle automation
Traditional tools rely on CSS selectors, XPath, or API-only integrations. When a layout changes, those selectors break and you must update your code. The Coasty computer use API lets your agent see the screen and reason about elements. It can handle dynamic UIs, missing APIs, or legacy systems where no documentation exists. Because the agent acts like a human, it works across browsers, desktop apps, and terminals with minimal changes.
Building production workflows
- ●Use workflows to orchestrate multi-step processes. POST /v1/workflows defines a versioned JSON DSL with steps like task, assert, if, loop, parallel, human_approval, retry, succeed, and fail.
- ●Variables like {{inputs.x}} and stepId.field let you pass data between steps. Conditions are structured objects. You can enforce budget_cents, max_iterations, and deadline_seconds as hard guards.
- ●POST /v1/workflows/{id}/runs and POST /v1/workflows/runs start a workflow run. Each task step is billed $0.05. Workflows keep your logic declarative and reusable across machines.
- ●For local development, the MCP server lets you drive Coasty from Cursor, Claude Desktop, or other MCP clients without writing direct API calls.
Machines for real desktops
- ●POST /v1/machines provisions a cloud VM you can start, stop, and snapshot. The agent drives real desktops, browsers, and terminals, not just API calls.
- ●Use snapshots to save the state of a machine after a setup step. You can then start multiple agents on the same machine for parallel tasks or resume from a stable state.
- ●Combine machines with task runs and workflows to build end-to-end production pipelines that install software, configure environments, and run tests.
The Coasty Computer Use API gives you a path from a simple prototype to a full production system. Start with /v1/runs for quick task automation, then layer on sessions, workflows, and machines for reliability and scale. Check the docs and get a key at https://coasty.ai/developers to start building computer use agents today.