From Prototype to Production with the Coasty Computer Use API
You want to automate anything a human can do on a desktop. That means clicking, typing, scrolling, waiting for pages to load, things that change layout, buttons, and selectors overnight. Traditional automation tools fail fast here. The Coasty computer use API solves this by giving you a stateful agent that sees the screen and decides actions like a person. In this guide you will build a prototype, then wire it into a production workflow, and finally run it on a real cloud machine.
How it works
The core flow is a loop: capture a screenshot, send it to the model, get an action, execute it. The API supports both stateless and stateful modes. In stateless mode you POST /v1/predict once per screenshot. In stateful mode you POST /v1/sessions to create a session, then POST /v1/sessions/{id}/predict in a loop. Both return a status field that tells you when the task is done. The /v1/runs endpoint drives this pattern for you, billing $0.05 per agent step when you let the server orchestrate everything.
curl -X POST https://coasty.ai/v1/predict \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"image": "$(base64 -w 0 screenshot.png)",
"instruction": "Click the login button and enter your email and password.",
"cua_version": "v3"
}' | jq .Stateful sessions keep context
- ●POST /v1/sessions creates a trajectory. Each predict call receives the full history.
- ●The predict response includes an actions array and status. status can be done, continue, or error.
- ●Billed at $0.04 per predict call after the first session creation ($0.10).
- ●You can track a session across multiple pages without re-encoding the whole history.
Create a session once, then loop predict on it until status is done.
Task Runs for production orchestration
- ●POST /v1/runs lets you specify machine_id, task, cua_version (v4 is autonomous with a pass/fail verifier), max_steps, deadline_seconds, and webhook_url.
- ●The server starts the agent on the machine, bills $0.05 per agent step, and streams events via GET /v1/runs/{id}/events.
- ●States include queued, running, awaiting_human, succeeded, failed, cancelled, timed_out.
- ●Use on_awaiting_human to pause, fail, or cancel when the agent needs human input.
Where this beats brittle automation
Traditional tools rely on CSS selectors, XPaths, or hardcoded IDs. When a website redesigns the markup, your scripts break. Coasty never knows the HTML. It sees pixels and text. It can click the button by its position, label, or visual context. It can handle dynamic popups, changing layouts, and even missing elements by reasoning about what it sees. This gives you a single agent that works across browsers, desktop apps, and terminals, not a different script for every target.
Start with a small prototype using /v1/predict, then move to stateful sessions for multi-step workflows, and finally use /v1/runs on cloud machines for production reliability. Get your API key and start building at https://coasty.ai/developers.