Back to Blog
Guide

Marcus Sterling8 min
⌘+W

Most automation scripts run one task after another. A login, a click, a form submission, a file download. They fail when the UI changes or a popup appears. You need structure. You need conditionals. You need to run steps in parallel. The Coasty workflow DSL is a versioned JSON language for defining multi-step automation. It lets you create a workflow, submit it as a run, and let the agent handle real desktops, browsers, and terminals using the Computer Use API. Each task step costs $0.05. You define steps with names, types, and structured conditions.

Workflow DSL basics

  • POST /v1/workflows creates a versioned workflow.
  • A workflow body is a JSON array of step objects.
  • Step types: task, assert, if, loop, parallel, human_approval, retry, succeed, fail.
  • Variables use double braces like {{inputs.username}}.
  • Hard guards: budget_cents, max_iterations, deadline_seconds.
  • Task steps are billed $0.05 each.
  • You can run a workflow inline with POST /v1/workflows/runs or via POST /v1/workflows/{id}/runs.

A workflow is a versioned JSON DSL of runs. Use POST /v1/workflows to define steps, then POST /v1/workflows/{id}/runs to execute.

Step types at a glance

  • task: runs an agent on a machine for a description.
  • assert: checks a condition, fails the run if false.
  • if: conditionally executes a branch of steps.
  • loop: repeats a block while a condition is true.
  • parallel: runs steps concurrently (limited by agent capabilities).
  • human_approval: pauses for approval or cancellation.
  • retry: retries a task or block on failure.
  • succeed: marks the run as successful.
  • fail: marks the run as failed.

Workflow example

  • Define a workflow with a username and URL input.
  • Task to open the URL with an agent.
  • Assert that the page title contains the expected string.
  • If the assertion passes, assert another condition.
  • Loop to retry a task up to max_iterations times.
  • Parallel to run multiple tasks concurrently.
  • Use budget_cents, max_iterations, and deadline_seconds as hard guards.
bash
curl -X POST https://coasty.ai/v1/workflows \ 
  -H "X-API-Key: $COASTY_API_KEY" \ 
  -H "Content-Type: application/json" \ 
  -d '{ 
    "name": "login_and_checkout", 
    "version": 1, 
    "steps": [ 
      { 
        "id": "open_page", 
        "type": "task", 
        "machine_id": "cloud-debian", 
        "description": "Open https://example.com in the default browser and ensure the page loads.", 
        "cua_version": "v3" 
      }, 
      { 
        "id": "check_title", 
        "type": "assert", 
        "condition": { 
          "kind": "contains", 
          "field": "page.title", 
          "value": "Example Domain" 
        } 
      }, 
      { 
        "id": "assert_logged_in", 
        "type": "if", 
        "condition": { 
          "kind": "equals", 
          "field": "page.title", 
          "value": "Dashboard" 
        }, 
        "then": [ 
          { 
            "type": "assert", 
            "condition": { 
              "kind": "exists", 
              "field": "page.element.dashboard_header" 
            } 
          } 
        ] 
      }, 
      { 
        "id": "retry_login", 
        "type": "loop", 
        "max_iterations": 3, 
        "condition": { 
          "kind": "not_contains", 
          "field": "page.title", 
          "value": "Dashboard" 
        }, 
        "steps": [ 
          { 
            "type": "task", 
            "machine_id": "cloud-debian", 
            "description": "Log in using the provided username and password, then verify the dashboard appears.", 
            "cua_version": "v3" 
          } 
        ] 
      }, 
      { 
        "id": "parallel_tasks", 
        "type": "parallel", 
        "steps": [ 
          { 
            "type": "task", 
            "machine_id": "cloud-debian", 
            "description": "Open the login page again in a separate browser window.", 
            "cua_version": "v3" 
          }, 
          { 
            "type": "task", 
            "machine_id": "cloud-debian", 
            "description": "Open the product catalog in a separate browser window.", 
            "cua_version": "v3" 
          } 
        ] 
      }, 
      { 
        "id": "succeed", 
        "type": "succeed" 
      } 
    ], 
    "hard_guards": { 
      "budget_cents": 200, 
      "max_iterations": 10, 
      "deadline_seconds": 300 
    } 
  }'

Where this beats brittle automation

  • Computer use agents see the screen and act like a human. They handle layout shifts, dynamic content, and popup windows.
  • Selectors and API calls break when UI changes. The workflow DSL lets you define business logic at the orchestration level.
  • Task steps are billed $0.05 each, but you see real desktops and browsers, not just API-only tools.
  • Hard guards ensure runs don't exceed budget or time.
  • Variables like {{inputs.username}} let you parameterize workflows across runs.

The Coasty workflow DSL gives you structured, multi-step automation for real desktops and browsers. Build tasks, asserts, conditionals, loops, and parallel steps with the Computer Use API. Each task step costs $0.05. Get a key at https://coasty.ai/developers and start building workflows.

© 2026 Coasty

Backed byYCombinator