Back to Blog
Guide

Lisa Chen6 min
⌘+Z

Manual scripts break when apps change layout, buttons shift, or unexpected states appear. The Workflow DSL lets you describe a compound automation as a versioned JSON document. You combine task steps, asserts, conditionals, loops, and parallel branches into a single workflow and let the server drive it. This gives you a single source of truth for complex automation, with clear semantics and predictable billing.

How the Workflow DSL works

A workflow is a versioned JSON document submitted to POST /v1/workflows. Each step is one of the DSL types: task, assert, if, loop, parallel, human_approval, retry, succeed, or fail. Tasks drive the agent, assert steps validate state, conditionals branch execution, loops repeat blocks, and parallel steps run multiple tasks concurrently. The server executes the workflow as a series of runs, each billed $0.05 per agent step. The DSL references variables like {{inputs.x}} or stepId.field, making it composable and parameterizable.

bash
curl -X POST https://coasty.ai/v1/workflows \
  -H "Authorization: Bearer $COASTY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "my-workflow",
    "version": "1.0",
    "steps": [
      {
        "type": "task",
        "description": "Open browser and navigate to example.com"
      },
      {
        "type": "if",
        "condition": {
          "type": "screen_text",
          "text": "Welcome",
          "exact": true
        },
        "then": [
          {
            "type": "task",
            "description": "Click the Sign In button"
          }
        ]
      },
      {
        "type": "loop",
        "max_iterations": 3,
        "condition": {
          "type": "screen_text",
          "text": "Success",
          "exact": true
        },
        "steps": [
          {
            "type": "task",
            "description": "Wait for the next step"
          }
        ]
      },
      {
        "type": "parallel",
        "steps": [
          {
            "type": "task",
            "description": "Task A"
          },
          {
            "type": "task",
            "description": "Task B"
          }
        ]
      },
      {
        "type": "assert",
        "description": "Verify the final page title",
        "check": {
          "type": "window_title",
          "value": "Example Domain"
        }
      },
      {
        "type": "succeed"
      }
    ],
    "hard_guards": {
      "max_iterations": 100,
      "deadline_seconds": 600,
      "budget_cents": 500
    }
  }'

Step types in the DSL

  • task: Drives the agent to perform sequences of actions. Each task step is billed $0.05 per agent step.
  • assert: Validates screen state or app behavior. Tasks continue only if the assertion passes.
  • if: Branches into then or else blocks based on a structured condition such as screen_text or window_title.
  • loop: Repeats a sub‑workflow up to max_iterations while the condition holds. Useful for retry and polling patterns.
  • parallel: Runs multiple task steps concurrently. Each sub‑step is billed $0.05 per agent step.
  • human_approval: Pauses execution and waits for human action. Options are pause, fail, or cancel.
  • retry: Repeats the previous task with exponential backoff before giving up.
  • succeed: Marks the workflow as successful.
  • fail: Marks the workflow as failed with an optional message.

The Workflow DSL is versioned JSON, billing is $0.05 per agent step, and hard guards like max_iterations, deadline_seconds, and budget_cents prevent runaway runs.

Where this beats brittle automation

Traditional automation relies on selectors, XPath, or API endpoints that break when UI changes. The Workflow DSL uses real screen state via the computer use API. The agent sees the screen, follows natural instructions, and can adapt to layout shifts. Asserts and conditionals validate the state instead of brittle element locators, and parallel steps let you coordinate multiple agents or workflows in parallel. This gives you robust, composable automation that scales with your needs.

Start modeling your automation as a workflow DSL today. Create tasks, conditionals, loops, and parallel branches in a single JSON document, and rely on the server to drive and validate each step. Get your API key at https://coasty.ai/developers and begin building reliable computer use agents.

© 2026 Coasty

Backed byYCombinator