Multi-Step Automations with the Coasty Workflows API
You want an agent that does more than a single screenshot-and-click loop. You need it to handle retries, conditional steps, parallel branches, and assertions. The Coasty Workflows API gives you a versioned JSON DSL that defines the whole job as a graph of steps. Each task step costs $0.05. This lets you compose reliable multi-step workflows that drive browsers, terminals, and desktop apps with the same computer use API you already know.
How workflows work
A workflow is a versioned JSON payload you POST to /v1/workflows. Each top-level object defines steps like task, assert, if, loop, parallel, human_approval, retry, succeed, and fail. Tasks are the only steps that incur a $0.05 charge per agent step. Conditions and variables are structured objects. You can reference variables like {{inputs.x}} or stepId.field. Hard guards include budget_cents, max_iterations, and deadline_seconds. Once the workflow is created, you POST /v1/workflows/{id}/runs to start a concrete job that uses the workflow definition. You can also run ad-hoc inline workflows by POSTing to /v1/workflows/runs with the DSL directly in the request body.
Create a workflow that installs a Python package, asserts the version, retries on failure, and succeeds.
export COASTY_API_KEY=$(cat ~/.coasty-key)
curl -X POST https://coasty.ai/v1/workflows \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"version": "1.0",
"steps": [
{
"type": "task",
"name": "install_package",
"task": "Install the requests library in the terminal",
"retry": {
"max_attempts": 2,
"backoff_seconds": 5
}
},
{
"type": "assert",
"name": "version_assert",
"condition": {
"type": "shell_output",
"command": "pip show requests | grep Version"
},
"assertion": {
"type": "contains",
"expected": "Version: 2.31.0"
}
},
{
"type": "succeed",
"name": "install_success",
"message": "Requests library installed successfully."
}
],
"hard_guards": {
"max_iterations": 10,
"deadline_seconds": 600
}
}'
# Start a concrete run of the workflow
WORKFLOW_ID=$(curl -s https://coasty.ai/v1/workflows \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"version": "1.0","steps":[{"type":"task","task":"Install requests"}]}' | jq -r .id)
curl -X POST "https://coasty.ai/v1/workflows/$WORKFLOW_ID/runs" \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"inputs": {"package": "requests"}}'Step types you can use
- ●task: runs a computer use agent step, billed $0.05 per agent step. Includes retry and backoff options.
- ●assert: validates a condition, such as shell output or a screenshot text match. Can fail the workflow if the assertion fails.
- ●if: conditional branch based on a condition object. Supports logical operators and variable references.
- ●loop: repeats a block of steps up to max_iterations or until a condition is met.
- ●parallel: runs multiple steps concurrently using the same workflow DSL.
- ●human_approval: pauses the workflow until you approve it. Use with on_awaiting_human settings in runs.
- ●retry: retries a task step with configurable max_attempts and backoff_seconds.
- ●succeed: marks the workflow as succeeded with a message.
- ●fail: marks the workflow as failed with a message.
Every task step costs $0.05 per agent step. Use hard_guards to cap iterations and deadline_seconds to avoid runaway runs.
Where this beats brittle automation
Traditional UI automation relies on brittle selectors and frequent updates when UI changes. The computer use API lets the agent see the screen and act like a human. Workflows orchestrate multiple such interactions, handle retries, and assert outcomes without you writing fragile code. Because the agent drives real desktops, browsers, and terminals, you get the same reliability you get from human execution, but at scale. The declarative DSL makes workflows versioned, reviewable, and composable across projects.
Start building multi-step automations with the Coasty Workflows API. Define your workflow as a versioned JSON DSL, start runs, and watch the agent coordinate tasks, retries, and assertions. Get a key at https://coasty.ai/developers and build agents that do real work.