Launch HN: Coasty (YC S26) – An API for computer-use agents
Launch HN: Coasty (YC S26) – An API for computer-use agents
Welcome to the Coasty API, a powerful interface designed to execute autonomous tasks on managed virtual machines. Whether you want to orchestrate complex workflows or maintain granular control via prediction primitives, Coasty provides the infrastructure to make AI agents actually work on a computer.
[!TIP] Building with an AI assistant? Check out the
llms.txtreference to generate optimized prompts for tools like Claude Code, Cursor, or ChatGPT.
🚀 Getting Started: The Automation Hierarchy
Coasty offers different levels of abstraction depending on how much control you need. You can start at the highest level and "drop down" to lower primitives as your requirements become more specific.
Primary Automation Levels
- Task Runs: A single goal driven to completion autonomously.
- Workflows: A programmatic collection of multiple tasks (includes branching and loops).
- Machines: Managed Linux or Windows environments providing the browser, terminal, and filesystem.
Low-Level Primitives (Manual Execution)
If you prefer to own the control loop, use these stateless/stateful tools:
predict: A single stateless step.sessions: A stateful loop for screenshots.ground: Used to find specific screen coordinates.parse: Converts code into executable actions.
Choosing Your Entry Point
| Start With | Use it when... |
|---|---|
| Task Runs | You have one goal that needs to be autonomously verified as "done." |
| Workflows | You need sequencing, budgets, human-in-the-loop approvals, or branching logic. |
| Machines | You specifically need a managed OS (Windows/Linux) with a browser and shell. |
| Primitives | Your app must control every single screenshot and prediction manually. |
🔐 Authentication & Billing
All requests are sent via standard HTTPS to https://coasty.ai/v1.
API Key Management
You must include your secret key in every authenticated request. While Authorization: Bearer <key> is supported, the canonical method is the X-API-Key header.
⚠️ Critical Warning:
Do not do this.
Including the word "Bearer" inside the X-API-Key: Bearer sk-coasty-live-xxxX-API-Key header is a common error that results in a 401 INVALID_API_KEY response.
Security Best Practices:
- Store keys in environment variables.
- Keep keys server-side.
- Never commit keys to version control or expose them in client-side JS.
Key Types & Behavior
| Prefix | Kind | Behavior |
|---|---|---|
sk-coasty-live- | Live | Executes real models; deducts from your USD wallet. |
sk-coasty-test- | Test | Uses mock VMs; $0 cost; identical request/response shapes for CI/CD. |
The Billing Logic
Coasty uses a "charge-then-refund" model to ensure reliability.
- Pre-charge: Every billed call is charged before the model runs.
- Automatic Refund: If a
5xxerror occurs, the charge is reversed. - Verification: Check the
X-Credits-Refundedheader to confirm a refund. - Short-circuit:
401,403, or402errors occur before any charges are applied.
🛠️ Running Your First Task
To launch an autonomous agent, follow this checklist:
- Obtain a test key from the API dashboard.
- Provision or select a
machine_id. - Set your environment variable:
export COASTY_API_KEY=sk-coasty-test-your_key. - Execute a
POST /v1/runsrequest.
Implementation Example (Python)
import os, time, requests
BASE = "https://coasty.ai/v1"
HEADERS = {"X-API-Key": os.environ["COASTY_API_KEY"]}
TERMINAL_STATES = {"succeeded", "failed", "cancelled", "timed_out"}
# 1. Initiate the autonomous run
payload = {
"machine_id": "mch_test_0123456789abcdef",
"task": "Open the billing page and download the latest invoice as PDF",
"cua_version": "v5", # Options: v1, v3, v4, v5 (v5 is default)
"max_steps": 40,
"on_awaiting_human": "pause",
}
run = requests.post(
f"{BASE}/runs",
headers={**HEADERS, "Idempotency-Key": "order-4821"},
json=payload,
timeout=30
).json()
run_id = run["id"]
print(f"Initial Status: {run['status']}") # Usually 'queued'
webhook_secret = run.get("webhook_secret") # Save this for HMAC verification
# 2. Poll for completion
while True:
run = requests.get(f"{BASE}/runs/{run_id}", headers=HEADERS, timeout=30).json()
print(f"Status: {run['status']} | Steps: {run['steps_completed']}")
if run["status"] in TERMINAL_STATES:
break
time.sleep(2)
print(f"Final Result: {run['result']}")
# Returns: { "passed": bool, "status": str, "summary": str }
🔄 Understanding the Agent Loop
When you use a Task Run, Coasty manages the entire execution cycle on its backend. You don't need to manually trigger every step.
Task Run Details
- Communication: You can track progress via polling, SSE (Server-Sent Events) for live streaming, or HMAC-signed webhooks.
- Human Intervention: If the agent hits a wall, it can
pauseand wait for human takeover before resuming. - Cost Calculation:
The cost is calculated based on the engine version used:
- v5 Engine: \0.05$ / step
- v1 Engine (Legacy): \0.08$ / step
Next Steps:
- Explore Task Fields and lifecycle states.
- Set up Streaming Events to eliminate polling.
- Build complex Workflows for repeatable business automation.