You want to automate a real app, login to a dashboard, fill out a form, run a CLI test, or open a browser and click through a flow. API-only tools break when UI changes. Cookies expire. Selectors vanish. You need an agent that sees the screen and acts like a human. The /v1/runs endpoint gives you that: you submit a task and a machine environment, and the Coasty agent works until the goal is achieved, timed out, or cancelled. No brittle selectors. No manual clicks. Just a single API call plus an event stream to track progress.
How /v1/runs works under the hood
POST /v1/runs is the entry point for a self-driving task run. You provide a machine_id that the Coasty service will use to start a real desktop or browser session. You also describe the task and a deadline. The JSON body supports several options. You can set cua_version to "v3" or "v4". The v4 variant includes a pass/fail verifier. You can append instructions to the base system prompt. You can set max_steps to limit loop iterations. You can supply a deadline_seconds value. You can tell the platform what to do when the agent is stuck waiting for a human, "pause", "fail", or "cancel". You can also provide a webhook_url for asynchronous callbacks. After the POST, you GET /v1/runs/{id} or stream events from /v1/runs/{id}/events. The states are queued, running, awaiting_human, succeeded, failed, cancelled, timed_out. Each agent step is billed $0.05.
curl -X POST https://coasty.ai/v1/runs \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"machine_id": "machine-xyz",
"task": "Open https://coasty.ai in Chrome, scroll to the features section, and take a screenshot",
"cua_version": "v4",
"instructions": "Focus on the features section and take a screenshot",
"max_steps": 200,
"deadline_seconds": 300,
"on_awaiting_human": "pause",
"webhook_url": "https://example.com/webhook"
}'Track a run from request to completion
After you POST /v1/runs, you receive a run_id. Use it to GET /v1/runs/{id} to fetch the latest state and result. Or open the event stream with GET /v1/runs/{id}/events. Each event is a Server-Sent Event line prefixed with data:. You can reconnect with the Last-Event-ID header to resume from your last known offset. The events let you know when the agent starts, when it changes state, when it finishes, and when it fails. You can poll or stream, depending on your architecture. If you want to cancel, POST /v1/runs/{id}/cancel. To resume after a human pause, POST /v1/runs/{id}/resume.
POST /v1/runs creates an autonomous agent, streams events with GET /v1/runs/{id}/events, and bills $0.05 per agent step.
Where this beats brittle automation
Traditional automation relies on selectors and explicit APIs that change often. A button ID might shift, a class name might be renamed, or a layout might rearrange. Your script breaks. The Coasty computer use agent works by looking at screenshots and mimicking human actions. It can handle dynamic text, changing layouts, and unexpected UI states. Because the agent runs on a real desktop or browser, it can interact with any app, not just the tools you hardcode. You describe the goal in natural language. The agent figures out the steps. This makes your automation future-proof against UI changes.
Next steps and getting a key
You now know how to POST /v1/runs, stream events, and handle states. Start by provisioning a machine with POST /v1/machines if you need a specific environment. Experiment with different cua_version values and verifier configurations. Use workflows (POST /v1/workflows) for multi-step plans. Integrate the event stream into your application to show live progress. To start, get an API key at https://coasty.ai/developers. Create a machine, set up your task, and launch your first autonomous computer use agent.
Want to see this in action?
View Case Studies