Back to Blog
Tutorial

Sarah Chen9 min
+W

You want an agent that installs software, fills out web forms, or repeats a multi-step process across different environments. Traditional automation tools force you to hardcode selectors, manage state, and retry manually. The Coasty workflow DSL lets you express that logic declaratively in a versioned JSON schema. You post a workflow to /v1/workflows, let the agent drive real machines, and pay per agent step at $0.05. This post shows how each step type works, gives a working example, and explains why computer use beats brittle selectors.

How the workflow DSL works

A workflow is a JSON document you POST to /v1/workflows. The body must include a version field and an array of steps. Each step is an object with a type and required fields. The DSL supports task, assert, if, loop, parallel, human_approval, retry, succeed, and fail. Variables follow the double-brace syntax {inputs.x} and stepId.field. Hard guards like budget_cents, max_iterations, and deadline_seconds apply globally and per step. When you POST /v1/workflows/{id}/runs, the server starts a task run that drives an agent on a cloud machine. Each agent step costs $0.05. GET /v1/runs returns the run status and results. Events stream via GET /v1/runs/{id}/events for real-time updates.

bash
curl -X POST https://coasty.ai/v1/workflows \
  -H "X-API-Key: $COASTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "version": "1.0",
    "budget_cents": 500,
    "max_iterations": 20,
    "deadline_seconds": 600,
    "steps": [
      {
        "type": "task",
        "name": "install_python",
        "prompt": "Open a terminal and install Python 3.11 using your package manager."
      },
      {
        "type": "assert",
        "name": "python_installed",
        "expression": "python3 --version",
        "expected": "Python 3.11"
      },
      {
        "type": "if",
        "condition": "{python_installed.status} == 'succeeded'",
        "then": [
          {
            "type": "task",
            "name": "build_project",
            "prompt": "Run the project build command.",
            "max_steps": 10
          }
        ],
        "else": [
          {
            "type": "fail",
            "message": "Python installation failed."
          }
        ]
      },
      {
        "type": "loop",
        "name": "check_result",
        "condition": "{check_result.status} == 'pending'",
        "max_iterations": 10,
        "step": {
          "type": "task",
          "name": "poll_result",
          "prompt": "Open the result page and check for completion status."
        }
      },
      {
        "type": "parallel",
        "name": "parallel_tasks",
        "steps": [
          {
            "type": "task",
            "name": "task_a",
            "prompt": "Run task A."
          },
          {
            "type": "task",
            "name": "task_b",
            "prompt": "Run task B."
          }
        ]
      },
      {
        "type": "succeed",
        "message": "Workflow completed."
      }
    ]
  }'

Step types in detail

  • task: instructs the computer use agent to perform an action. Each task step is billed $0.05 per agent step. You can add instructions to a run by passing an optional instructions parameter when POSTing /v1/runs.
  • assert: validates a condition after a task runs. The expression field evaluates against step outputs and workflow variables. If the assertion fails, the run transitions to failed unless a retry or if/else handles it.
  • if: branches execution based on a condition. The condition field supports comparison operators and variable references like {python_installed.status} == 'succeeded'. The then array runs on success, the else array on failure. You can nest if blocks.
  • loop: repeats a step until a condition becomes false or max_iterations is reached. The condition field uses the same variable syntax as if. The step field contains the sub-step to repeat. The loop stops when the condition evaluates to false or iterations exceed the limit.
  • parallel: executes multiple steps concurrently. Each sub-step is a separate task. The DSL waits for all parallel branches to finish before proceeding. Parallel is useful for splitting work across multiple agents or browser tabs.

Each task step costs $0.05. Use if, loop, and parallel to reduce unnecessary agent work and control your bill.

Where this beats brittle automation

API-only tools struggle when UI changes or when an element is hidden behind a modal. Computer use agents read the screen via screenshots and act like humans. You don’t need to maintain fragile CSS selectors or maintain detailed DOM schemas. The workflow DSL lets you reason about outcomes (assert) and control flow (if, loop, parallel) independently of screen changes. This makes your agents more resilient and easier to maintain. The workflow versioning feature also lets you roll back changes without redeploying new code.

The workflow DSL gives you a powerful way to orchestrate computer use agents. Define task, assert, if, loop, and parallel steps in JSON, POST to /v1/workflows, and let the agent run on real desktops, browsers, and terminals. Each agent step is billed at $0.05. Build reliable automation pipelines that scale across environments. Get your API key and start building at https://coasty.ai/developers.

© 2026 Coasty

Backed byYCombinator