Back to Blog
Engineering

Emily Watson6 min
Alt+F4

Building a computer use agent often means chaining many independent steps: launching apps, filling forms, waiting for elements, and handling failures. Doing this manually or with brittle selectors quickly becomes unmaintainable. The workflow DSL lets you describe a multi-step agent as a versioned JSON document and post it in one request. The server executes task, assert, if, loop, parallel, human_approval, retry, succeed, and fail steps exactly as defined, handling retry logic, conditional branches, and coordination automatically.

How the workflow DSL works

You POST a JSON workflow document to /v1/workflows. The workflow is versioned, so you can evolve your automation safely. Each step has a type and a set of fields that depend on the step. Task steps drive the computer use agent and are billed $0.05 per agent step. Assert steps validate that a condition is met after a task runs, often checking a screenshot or a status field. If steps evaluate a condition and choose between branches. Loop steps iterate over a collection or a count with hard guards like max_iterations and deadline_seconds. Parallel steps run multiple branches concurrently. All steps are part of the same request and are executed by the server in order, with variables using double-brace syntax like {{inputs.x}} or stepId.field.

bash
curl -X POST https://coasty.ai/v1/workflows \ 
  -H "Content-Type: application/json" \ 
  -H "X-API-Key: $COASTY_API_KEY" \ 
  -d '{ 
    "version": "1.0", 
    "steps": [ 
      { "type": "task", "task": "open https://coasty.ai", "cua_version": "v4" }, 
      { "type": "assert", "field": "title", "expected": "Coasty.ai - Computer Use API" }, 
      { "type": "if", "condition": { "field": "title", "operator": "==", "expected": "Coasty.ai - Computer Use API" }, 
        "then": [ 
          { "type": "task", "task": "click element with text "Home"", "cua_version": "v4" }, 
          { "type": "succeed" } 
        ], 
        "else": [ 
          { "type": "retry", "max_attempts": 3, "delay_seconds": 2, "steps": [
            { "type": "task", "task": "reload page", "cua_version": "v4" }
          ]} 
        ] 
      }, 
      { "type": "loop", "collection": "{{inputs.urls}}", "max_iterations": 5, "steps": [
        { "type": "task", "task": "open {{item}}", "cua_version": "v4" }, 
        { "type": "assert", "field": "url", "expected": "{{item}}" }
      ]}, 
      { "type": "parallel", "steps": [
        { "type": "task", "task": "open https://coasty.ai/docs", "cua_version": "v4" }, 
        { "type": "task", "task": "open https://coasty.ai/developers", "cua_version": "v4" }
      ]} 
    ] 
  }'

Step types you can use

  • task: A step that runs the computer use agent to execute actions on screen. Billed $0.05 per agent step. You provide task instructions and optionally cua_version (default v3, v4 uses an autonomous pass/fail verifier).
  • assert: Validates a field after a task or earlier step. Uses field names and operators like ==, !=, contains, or regex. Commonly checks a page title, URL, or a status field.
  • if: Evaluates a condition and selects between then and else branches. Conditions use the same field/operator syntax as assert. Useful for branching on success/failure or state changes.
  • loop: Iterates over a collection (e.g., a list of URLs) or a count with max_iterations and deadline_seconds guards. Each iteration runs its own steps and can set loop variables.
  • parallel: Runs multiple step branches concurrently. Great for launching multiple browser tabs or running independent checks at the same time.
  • human_approval: Pauses for manual intervention. The server sets the run state to awaiting_human. You can configure on_awaiting_human to pause, fail, or cancel the run.
  • retry: Re-runs a set of steps after a delay, with configurable max_attempts and delay_seconds. Useful for transient failures.
  • succeed: Marks the workflow run as successful. All prior steps must have passed.
  • fail: Marks the workflow run as failed. Use it to abort on error.

Task steps are billed $0.05 per agent step, but the workflow orchestration itself is free.

Where this beats brittle automation

Traditional automation relies on brittle selectors like XPath or CSS IDs that break when UI changes. The workflow DSL lets you focus on business intent, open this page, check this field, succeed or retry, without maintaining a fragile selector list. The server executes tasks like a human, navigating the screen, clicking, typing, and interpreting visual feedback. You can also run multiple agents in parallel, retry on transient failures, and handle human approval without writing glue code. This makes your computer use agent more robust, maintainable, and easier to evolve.

Now that you understand the workflow DSL, try building a multi-step agent that opens several URLs, checks their titles, and reports the results. Set up your workflow, POST it to /v1/workflows, and monitor progress with /v1/runs or the SSE events stream. Get your API key at https://coasty.ai/developers and start orchestrating intelligent computer use agents today.

© 2026 Coasty

Backed byYCombinator