Building a robust computer use agent often means chaining dozens of API calls, handling retries, and managing state across steps. The Coasty workflow DSL solves this by letting you write a versioned JSON description of your agent. The DSL defines step types like task, assert, if, loop, parallel, human_approval, retry, succeed, and fail. You then POST this DSL to /v1/workflows and run it via /v1/workflows/{id}/runs. Each task step is billed $0.05, while the workflow itself is a versioned JSON DSL that the server executes. This gives you declarative, maintainable automation that stays stable even when UI elements change.
How the workflow DSL works
The workflow DSL is a versioned JSON document that you POST to /v1/workflows. You can also run an inline DSL via POST /v1/workflows/runs. Each workflow is an array of steps. Supported step types include task, assert, if, loop, parallel, human_approval, retry, succeed, and fail. Task steps contain a machine_id, cua_version (default v3, v4 adds autonomous pass/fail verification), and a base_prompt. You can append instructions and set a system_prompt for the agent. Each task step costs $0.05 per agent step. The workflow supports variables like {{inputs.x}} and stepId.field. You can set hard guards such as budget_cents, max_iterations, and deadline_seconds. The server emits events via GET /v1/runs/{id}/events (Server-Sent Events) and returns state: queued, running, awaiting_human, succeeded, failed, cancelled, timed_out. You can cancel or resume a run with POST /v1/runs/{id}/cancel and POST /v1/runs/{id}/resume.
# POST a versioned workflow DSL
export COASTY_API_KEY=$(cat ~/.coasty_key)
curl -X POST https://coasty.ai/v1/workflows \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"version": 1,
"steps": [
{
"type": "task",
"machine_id": "cloud-vm-001",
"cua_version": "v3",
"base_prompt": "Open Chrome and navigate to https://coasty.ai",
"instructions": "Verify the page title contains Coasty",
"system_prompt": "You are a helpful desktop assistant."
},
{
"type": "assert",
"condition": {
"type": "contains",
"target": "{{step_0.screen_text}}",
"value": "Coasty"
}
}
],
"hard_guards": {
"budget_cents": 500,
"deadline_seconds": 120
}
}'Step types in detail
- task: Executes a computer use agent on a machine_id with base_prompt, instructions, and system_prompt. Each task step costs $0.05 per agent step.
- assert: Checks a condition against state like screen_text or variables. Conditions can be structured objects with types like contains, equals, or numeric comparisons.
- if: Evaluates a condition and runs one branch or another. You can nest if steps inside loops or parallel blocks.
- loop: Repeats a block of steps while a condition holds. Use max_iterations to guard against infinite loops.
- parallel: Runs multiple step blocks concurrently. Useful for launching multiple agents or steps in parallel.
- human_approval: Pauses the workflow and waits for manual approval before proceeding. You can configure on_awaiting_human to pause, fail, or cancel.
- retry: Retries a block of steps if a specified condition fails. You can set max_attempts and backoff parameters.
- succeed: Marks the workflow as successful and stops further execution.
- fail: Marks the workflow as failed and stops further execution.
Define your agent as a versioned JSON DSL and POST it to /v1/workflows. Each task step bills $0.05 per agent step.
Where this beats brittle automation
Traditional automation relies on brittle selectors like XPath or CSS selectors. When UI changes, these break and require rewrites. The workflow DSL abstracts away specific selector logic. You describe what the agent should do (e.g., find the button that contains text Log in) and let the computer use agent locate elements on the screen. The assert step validates the result against screen text or variables, not against a fixed selector. This makes your agents more resilient to UI evolution. Additionally, the DSL is versioned JSON, so you can track changes over time and roll back to previous versions. You can also use parallel steps to run multiple agents or tasks concurrently, something that is harder to orchestrate with pure API chaining.
Use the workflow DSL to build declarative, resilient computer use agents. Define tasks, asserts, if, loop, and parallel steps in a versioned JSON document and POST it to /v1/workflows. Start building complex automation workflows today. Get your API key at https://coasty.ai/developers.
Want to see this in action?
View Case Studies