Tutorial

From Prototype to Production with the Coasty Computer Use API

Sarah Chen||8 min
+Space

You have a prototype automation script that clicks buttons by index, scrapes pages by XPath, or polls APIs. It breaks when UI changes, new browsers appear, or selectors drift. You need a computer use agent that actually sees the screen and acts like a human. The Coasty computer use API gives you that. It provides a stateful trajectory memory, task runs, workflows, and real VMs so you can move from a quick POC to production automation.

How it works

The core flow is capture, predict, act. You send a base64 screenshot and an instruction to POST /v1/predict. The model returns actions and a status. You keep looping capture, predict, act until status is "done". For stateful memory you can create a session with POST /v1/sessions then use POST /v1/sessions/{id}/predict. To map a screenshot and element description to x,y coordinates you call POST /v1/ground. The API also includes a free parser at POST /v1/parse that turns pyautogui code into structured actions.

bash
curl -X POST https://coasty.ai/v1/predict \
  -H "X-API-Key: $COASTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "cua_version": "v3",
    "instruction": "Click the Login button in the top right",
    "screenshot": "<base64 encoded screenshot>"
  }'

Stateful sessions and trajectory memory

  • Create a session with POST /v1/sessions. The response includes an id.
  • Use POST /v1/sessions/{id}/predict for the next step. The server keeps the trajectory in memory across steps.
  • Session-based calls are billed at $0.04 per predict, compared to $0.05 for a standalone predict call.

Use sessions for long-running agents so the model remembers the current state and UI context across steps.

From single step to task runs

  • For a full task, use POST /v1/runs. Provide machine_id, task, cua_version (v3 or v4), optional instructions, system_prompt, max_steps, deadline_seconds, on_awaiting_human (pause/fail/cancel), and webhook_url.
  • The server runs an agent until completion. States include queued, running, awaiting_human, succeeded, failed, cancelled, timed_out.
  • You can stream events with GET /v1/runs/{id}/events using Last-Event-ID to reconnect.
  • Task runs cost $0.05 per agent step, billed to your prepaid USD wallet where 1 credit is $0.01.

Where this beats brittle automation

Traditional automation relies on brittle selectors like XPath, CSS, or element IDs. A UI layout change or a new browser version breaks the script. The Coasty computer use agent sees the screen, understands context, and executes actions like a human. It can handle dynamic UIs, native dialogs, and mixed environments without hard selectors. You also get a workflow DSL for orchestration, real VMs for desktop and browser sessions, and an MCP server to integrate with Cursor, Claude Desktop, or other MCP clients.

Start by prototyping a single-step agent with /v1/predict, then move to stateful sessions and task runs for production. Build workflows, deploy to VMs, and integrate with your favorite IDE. Get your API key at https://coasty.ai/developers and start building a computer use agent that actually works.

Want to see this in action?

View Case Studies
Try Coasty Free