Building a multi-step automation is easy with a single API call. The hard part is handling errors, retries, and conditional logic. The Workflows API gives you a versioned JSON DSL to orchestrate tasks, retry steps, and enforce guards like budget_cents, max_iterations, and deadline_seconds. Each task step is billed $0.05, and you can run workflows directly or inline without managing sessions yourself.
How the Workflows API works
You POST a JSON workflow to /v1/workflows to create a versioned definition. The DSL supports step types like task, assert, if, loop, parallel, human_approval, retry, succeed, and fail. Variables are referenced as {{inputs.x}} or stepId.field. Guards include budget_cents, max_iterations, and deadline_seconds. After creating a workflow, you can run it with POST /v1/workflows/{id}/runs or POST /v1/workflows/runs for ad-hoc inline workflows. Each task step is billed $0.05.
curl https://coasty.ai/v1/workflows \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"version": 1,
"steps": [
{
"id": "login",
"type": "task",
"task": "Log in to a web dashboard",
"system_prompt": "You are a computer use agent. Use the computer use API to interact with the browser and desktop",
"on_awaiting_human": "pause",
"max_steps": 20
},
{
"id": "assert_logged_in",
"type": "assert",
"condition": {
"type": "exists",
"selector": "text=Welcome, Alex",
"cua_version": "v4"
}
},
{
"id": "open_docs",
"type": "task",
"task": "Open the documentation site",
"cua_version": "v4"
},
{
"id": "download_latest",
"type": "task",
"task": "Download the latest release and verify the file name ends with .zip",
"cua_version": "v4"
},
{
"id": "succeed",
"type": "succeed"
}
],
"guards": {
"budget_cents": 500,
"max_iterations": 10,
"deadline_seconds": 600
}
}'Workflow DSL in depth
- task: executes a computer use agent step. Each task step is billed $0.05.
- assert: passes if a condition evaluates to true, fails otherwise.
- if: conditionally executes a branch. Conditions are structured objects.
- loop: repeats a block while a condition holds.
- parallel: runs multiple steps concurrently.
- human_approval: pauses the workflow for manual confirmation.
- retry: re-executes a step on failure, optionally with an exponential backoff.
- succeed: marks the workflow as successful.
- fail: marks the workflow as failed.
- Variables: use {{inputs.x}} or stepId.field to reference inputs or step outputs.
- Guards: budget_cents caps spending in cents, max_iterations limits total iterations, and deadline_seconds enforces a timeout.
Each task step is billed $0.05, making cost tracking straightforward.
Where this beats brittle automation
Traditional automation relies on fragile selectors that break when UI changes. The Workflows API lets the computer use agent see the screen and act like a human. You describe what to do, and the agent handles layout shifts, dynamic elements, and unstructured content. This is especially useful for long-running workflows where robustness outweighs speed.
Start orchestrating multi-step automations with the Workflows API. Define tasks, retries, and conditions with a versioned JSON DSL. Each task step is billed $0.05. Get a key at https://coasty.ai/developers.
Want to see this in action?
View Case Studies