Most automation scripts rely on brittle selectors or API mocks. If a UI changes, the script breaks. The Coasty workflow DSL lets you define a versioned JSON workflow that the server runs as a sequence of task and control steps. The server handles state, retries, and human approvals while you focus on business logic. You can use task, assert, if, loop, and parallel steps to model real user journeys across browsers, desktop apps, and terminals.
How the workflow DSL works
You define a workflow as a versioned JSON document with a top-level steps array. Each step can be one of the following types: task, assert, if, loop, parallel, human_approval, retry, succeed, or fail. Task steps call the server to drive a computer use agent through a user instruction. Assert steps validate a state by checking the last server event fields. If steps branch based on conditions. Loop steps iterate over a collection or counter. Parallel steps run multiple branches concurrently. All steps are versioned, and the server executes them sequentially or in parallel based on the structure. Pricing: each task step is billed $0.05, and a workflow itself costs nothing. You execute a workflow by creating a run with POST /v1/workflows/{id}/runs (or ad-hoc inline with POST /v1/workflows/runs).
# Install jq for JSON processing (curl alone works too)
# Set your API key from the environment
export COASTY_API_KEY=$(cat ~/.coasty_key)
# Example workflow DSL: login -> assert success -> loop retries if assert fails
workflow=$(cat <<'JSON'
{
"name": "login-and-verify",
"version": "1.0",
"steps": [
{
"type": "task",
"stepId": "login",
"description": "Navigate to login page and submit credentials",
"instruction": "Open https://example.com/login, fill username with '[email protected]', password with 'secret', and click the login button."
},
{
"type": "assert",
"stepId": "assert_logged_in",
"condition": {
"field": "last_event.status",
"operator": "==",
"value": "done"
}
},
{
"type": "if",
"stepId": "if_logged_in",
"condition": {
"field": "last_event.status",
"operator": "==",
"value": "done"
},
"then_steps": [
{
"type": "succeed"
}
],
"else_steps": [
{
"type": "task",
"stepId": "retry_login",
"description": "Retry login after 1 second delay",
"instruction": "Wait 1 second, then retry the login steps."
},
{
"type": "assert",
"stepId": "assert_retry_success",
"condition": {
"field": "last_event.status",
"operator": "==",
"value": "done"
}
},
{
"type": "if",
"stepId": "if_retry_success",
"condition": {
"field": "last_event.status",
"operator": "==",
"value": "done"
},
"then_steps": [
{
"type": "succeed"
}
],
"else_steps": [
{
"type": "fail",
"message": "Login failed after retries"
}
]
}
]
}
]
}
JSON
)
# Create the workflow
response=$(curl -s -X POST https://coasty.ai/v1/workflows \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d "$workflow")
# Extract the workflow ID
cat "$response" | jq -r '.id'
# Run the workflow (inline style)
runtime=$(curl -s -X POST https://coasty.ai/v1/workflows/runs \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d "$workflow")
echo "Workflow runtime response:"
echo "$runtime" | jq '.'
# Get run status
run_id=$(echo "$runtime" | jq -r '.run_id')
status=$(curl -s https://coasty.ai/v1/runs/$run_id \
-H "X-API-Key: $COASTY_API_KEY" | jq -r '.status')
echo "Run status $run_id: $status"
Task steps drive the agent
- Task steps call the server to drive a computer use agent (task steps cost $0.05 each).
- Each task step defines a description and an instruction string that the agent interprets as a user goal.
- The server loops capture, predict, and act until the status is 'done'.
- You can chain multiple task steps in sequence to model multi-page flows.
- You can also inject instructions via the task's instruction field or via the top-level instructions array in POST /v1/runs.
Every task step is $0.05 and runs the full computer use loop.
Assert steps validate state
- Assert steps check the last server event fields such as status or error_code.
- Conditions use a structured format: field, operator, value.
- If an assert fails, the server halts the workflow and reports failure.
- You can use assert steps before branching to ensure you only proceed when a condition is met.
- Assert steps are free and do not consume credits.
If and loop steps control flow
- If steps execute either then_steps or else_steps based on a condition on last_event fields.
- Loop steps iterate over a collection or counter, which you model via nested if and assert branches.
- Conditions are evaluated against the most recent server event, including success, failure, or awaiting_human states.
- Loop constructs are built by your DSL, not by the server, giving you full control over iteration logic.
- You can combine if and loop to implement retries, pagination, or state transitions.
Parallel steps run branches concurrently
- Parallel steps allow multiple branches to start at the same time.
- The server runs each branch as an independent run under your workflow.
- You can use parallel steps to split work, test multiple scenarios, or run complementary workflows.
- Parallel execution does not affect pricing per task step (still $0.05 each).
- The server aggregates results when branches complete, enabling you to decide on succeed or fail based on all outputs.
Where this beats brittle automation
Traditional automation relies on CSS selectors or XPath that break when UI changes. The workflow DSL lets you describe goals in natural language, and the server interprets the screen state and acts like a human. You can assert on status fields instead of fragile element presence checks. The server manages retries, awaits human approval, and streams events. This removes the need for brittle selectors and keeps your automation resilient to UI changes. You can also version your workflows and run them on different machines with the same JSON definition.
The Coasty workflow DSL gives you a versioned JSON format for defining complex computer use agents with task, assert, if, loop, and parallel steps. You can execute workflows via POST /v1/workflows/runs or POST /v1/workflows/{id}/runs. Each task step costs $0.05. Start building reliable, stateful agents that drive real browsers, desktops, and terminals. Get your API key at https://coasty.ai/developers and try the workflow DSL today.
Want to see this in action?
View Case Studies