Manual scripts break when a UI changes or a network request fails. API-only tools need fragile selectors. The Coasty Workflow DSL solves this by letting you describe a full automation flow as a versioned JSON DSL. You can chain tasks, verify outcomes with asserts, branch logic with if, loop over steps, and run independent paths in parallel. This keeps your agent stateful, reproducible, and debuggable without writing custom orchestrators.
How the Workflow DSL works
You send a versioned JSON DSL to POST /v1/workflows (billed $0.05 per task step). The DSL defines a sequence of steps such as task, assert, if, loop, parallel, human_approval, retry, succeed, and fail. Each step can reference variables like the double-brace inputs.x or stepId.field. Hard guards include budget_cents, max_iterations, and deadline_seconds. Once deployed, you start runs with POST /v1/workflows/{id}/runs. The server executes the plan, tracks state, and streams events via GET /v1/runs/{id}/events. Task steps charge $0.05 each. The DSL is versioned, so you can evolve workflows without breaking existing production runs.
# Create a workflow DSL that opens Chrome, navigates to a URL, asserts the page title,
# then runs a parallel branch to log in and another to check the cart.
# Save this to workflow.json and call the endpoint.
export COASTY_API_KEY=$(cat ~/.coasty-key)
# Create the workflow
# (replace <YOUR_WORKFLOW_ID> with the ID returned from the POST)
curl -X POST https://coasty.ai/v1/workflows \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d @workflow.json
# Start a run on the workflow
# (replace <YOUR_WORKFLOW_ID> with the ID returned from the POST)
curl -X POST https://coasty.ai/v1/workflows/<YOUR_WORKFLOW_ID>/runs \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"machine_id": "<YOUR_MACHINE_ID>"}'
# Stream events for the run
# (replace <RUN_ID> with the ID returned from the POST /runs)
curl -N https://coasty.ai/v1/runs/<RUN_ID>/events \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Accept: text/event-stream"Task and assert
- Task steps drive the agent with a natural language instruction. The DSL can include a system_prompt, max_steps, deadline_seconds, and optional on_awaiting_human (pause, fail, or cancel). Each task step incurs $0.05.
- Assert steps verify an outcome, such as a page title, element visibility, or a network response. You can reference variables like inputs.x or stepId.field. If an assertion fails, the step fails and the workflow halts unless you configure retries.
- Asserts give you guarantees without needing brittle selectors. The server evaluates the assertion against the current state and the last screenshot.
If, loop, and parallel
- If steps evaluate a condition (object with type and expression) and execute either the true or false branch. The condition can check variables, step results, or custom logic. This lets you adapt to runtime outcomes.
- Loop steps repeat a block of steps up to max_iterations times. You can guard the loop with budget_cents, deadline_seconds, and a condition. This is ideal for retries, pagination, or waiting for transient states.
- Parallel steps let you run two or more blocks at the same time. The DSL tracks each child run and waits for all to complete before continuing. This reduces total wall-clock time for independent branches.
Define your automation as a versioned JSON DSL, then start runs and stream events with POST /v1/workflows and POST /v1/workflows/{id}/runs, GET /v1/runs/{id}/events.
Where this beats brittle automation
Traditional scripts rely on brittle selectors and hard-coded steps. If a UI shifts, the script fails. API-only tools need you to know every endpoint and handle errors manually. The Workflow DSL lets you write high-level descriptions (task) and verify real outcomes (assert). You can branch on state (if), retry until success (loop), and parallelize independent work (parallel). The DSL is versioned and executed by a real computer use agent that sees the screen, clicks, types, and handles navigation. This reduces maintenance and increases reliability. Plus, you can integrate with machines (POST /v1/machines) to run on cloud VMs, browsers, and terminals.
The Workflow DSL gives you a versioned JSON layer over the Coasty computer use API. You can define complex automation flows with task, assert, if, loop, and parallel. Start building workflows, trigger runs, and stream events. Get your API key from https://coasty.ai/developers and try the DSL today.
Want to see this in action?
View Case Studies