Back to Blog
Guide

Sophia Martinez8 min
Ctrl+S

APIs are fast but they stop at the service boundary. To automate a real browser or desktop, you often need brittle selectors, unstable locators, or brittle APIs. The Coasty computer use API lets you send an instruction and a screenshot, then get back the exact mouse and keyboard actions needed to complete the task. You can prototype a human-like agent quickly and then scale it to production using stateful sessions, workflows, and multi-step task runs.

How the computer use API works

The core flow is capture, predict, act. You send a base64 screenshot and an instruction to POST /v1/predict. The model returns a list of actions with screen coordinates and a status. You loop until status is done. For stateful memory, start a session with POST /v1/sessions, send the screenshot there with POST /v1/sessions/{id}/predict, and continue. The agent can see the UI, understand context, and act like a human.

bash
curl -X POST https://coasty.ai/v1/predict \
  -H "X-API-Key: $COASTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "screenshot": "BASE64_IMAGE",
    "instruction": "Click the login button on the right side of the page",
    "cua_version": "v3"
  }'

Run multi-step tasks with task runs

  • POST /v1/runs creates a task run that the server drives to completion.
  • You provide a machine_id, task, and cua_version (v4 is autonomous with a pass/fail verifier).
  • Optional parameters include instructions appended to the base prompt, system_prompt, max_steps, deadline_seconds, on_awaiting_human, and webhook_url.
  • Each agent step costs $0.05. The run can be monitored with GET /v1/runs, GET /v1/runs/{id}, or streamed via GET /v1/runs/{id}/events (Server-Sent Events).
  • States include queued, running, awaiting_human, succeeded, failed, cancelled, and timed_out.

POST /v1/runs is the entry point for production task execution, billed $0.05 per agent step.

Scale with workflows

  • Use the workflow DSL (versioned JSON) to compose task runs, asserts, conditionals, loops, and parallel steps.
  • POST /v1/workflows defines a reusable workflow, POST /v1/workflows/{id}/runs executes it.
  • POST /v1/workflows/runs lets you run workflows inline without saving them first.
  • Task steps within a workflow are billed $0.05 each.
  • You can guard execution with budget_cents, max_iterations, and deadline_seconds.

Where this beats brittle automation

Coasty agents see the screen like a human does. They can handle layout shifts, dynamic text, and UI changes without you updating selectors. You send an instruction in natural language and get accurate mouse and keyboard actions. This is especially powerful for browser automation (login flows, data entry, testing) and desktop tasks (file operations, app workflows).

Start from a simple prototype with POST /v1/predict, move to stateful sessions, and then ship production workflows with POST /v1/runs and POST /v1/workflows. Get your API key at https://coasty.ai/developers and start building a computer use agent that drives real UIs.

© 2026 Coasty

Backed byYCombinator