POST /v1/workflows.
For editing graphs in the Console, see JSON editor (Canvas | JSON mode, IntelliSense, Apply to canvas).
JSON Schema: agentruntime.io/schemas/workflow-graph.schema.json
Graph structure
Every workflow graph requires:
Every step requires
id, type, and name.
Example 1 — MCP chain with parallel branches
Fetch data, fan out into parallel processing, merge, and validate:step-b2 and step-c run in parallel after step-b1 completes because they share a dependency but not each other.
Example 2 — MCP + Lua + LLM pipeline
Fetch product and customer data, calculate pricing in Lua, generate invoice text with an LLM:Example 3 — for_each over a list
Generate items with an LLM, then process each in parallel with Lua:for_each output includes result.count, result.max_parallel, and result.results[] with per-item index and result or error.
Example 3b — for_each multi-step body
Run a pipeline per list item (agent → lua tag):for_each_body_steps is required (use a one-element array for a single inner step). Legacy for_each_body is rejected at validation.
Example 3c — while (refine until good)
iteration_count, stopped_reason (condition_met or max_iterations), last (final body map), and iterations[].
Example 4 — Human approval gate
Pause before sending an email:Template variables
Composite loops: Inner body steps also expose
{{steps.<inner-id>.input.<field>}} using the inner step id from for_each_body_steps or while_body_steps. Parent loop nodes expose their own resolved inputs, e.g. {{steps.process-each.input.for_each_items}} or {{steps.refine.input.while_condition}}.
Legacy shapes: Do not use for_each_body, slug step ids, or catalog-agent-only canvas nodes.
Hyphenated step IDs work in templates; in Lua use steps.fetch_product (underscore alias) or steps["fetch-product"].
Execution controls
Apply to any step type:"enabled": false to skip a step with a synthetic completion (dependencies still resolve).
Validate before publish
Always dry-run before publishing:Next steps
- Step types — field reference per type
- Workflow Studio — visual authoring guide
- Human tasks — approval patterns