Steps, structured conditions, and variable refs
Workflow DSL
Workflow DSL, at a glance
Steps, structured conditions, and variable refs
definition.steps[]- 01Inputsvalidated run values
- 02Stepstyped operations
- 03Refsstructured value paths
- 04Outputresolved JSON
The DSL (dsl_version 2026-06-01) is a JSON object with a steps array and an optional output. Each step has an id and a type. A task step runs the agent and binds its result ({ status, passed, result, run_id, steps, error }) under both its save_as name and its step id, so later steps can read it.
{
"dsl_version": "2026-06-01",
"definition": {
"steps": [
{
"id": "fetch",
"type": "task",
"task": "Open order {{inputs.order_id}} and read the invoice total",
"save_as": "invoice"
},
{
"id": "check",
"type": "assert",
"condition": {
"op": "truthy",
"value": "{{invoice.passed}}"
},
"message": "Agent failed to read the invoice"
},
{
"id": "branch",
"type": "if",
"condition": {
"op": "contains",
"left": "{{invoice.result}}",
"right": "PAID"
},
"then": [
{
"id": "ok",
"type": "succeed",
"output": {
"state": "paid"
}
}
],
"else": [
{
"id": "no",
"type": "fail",
"message": "Invoice not marked paid"
}
]
}
],
"output": {
"paid": "{{invoice.result}}"
}
}
}Conditions are structured rather than expression strings, which keeps them injection-safe. Each left, right, or value is either a literal or a {{path}} reference. Paths are dotted lookups into inputs.*, vars.*, and any step id or save_as name.
budget_cents (spend cap in USD cents; 0 means unlimited), max_iterations (loop cap), and deadline_seconds (wall-clock). A breach ends the run as failed or timed_out.A definition is validated before it is accepted. The limits below are enforced at create and ad-hoc time, so an invalid definition is rejected with 422 VALIDATION_ERROR rather than failing mid-run.
definition is snapshotted into that run, so editing or replacing the workflow (which bumps its version) never changes runs already in flight. Each run records the workflow_version it executed.