agent-workflow/v1 format, start with Creating Workflows.
Shell paths and tool or provider availability must match your Mac before you run these examples.
Branching
Run a step only if a condition is true (if)
Attach if: to run a step only when a condition is true. When the condition is false, the step and everything downstream of it skip:
inputs.score >= 60, steps.check.output.exitCode == 0, or a plain boolean input.
Run the other branch (else_of)
else_of: runs a step only when the step it names was skipped by its condition. It’s the “else” side of an if:
Join and clean up (run_when: always)
A step with needs normally skips if any dependency skipped, and the run stops if a required dependency fails. run_when: always overrides both: the step runs as long as its dependencies have finished, whether they succeeded, skipped, or failed. Use it for joins and cleanup:
Turn a step off (enabled: false)
enabled: false keeps a step in the workflow but skips it on every run. Unlike a skipped condition, a step that is off doesn’t skip what comes after it:
- Its dependents still run, and anything that reads its output gets an empty value.
- Its
else_ofstep skips too.
true) to turn the step back on. In the editor, use Turn off step in the inspector.
Loops
Repeat for each item in a list (foreach)
foreach: runs the step once per item. Inside, {{ item }} is the current element and {{ index }} is its position. Downstream steps receive the collected array of outputs:
foreach also accepts an inline array, and it works with every kind of step: a foreach of tool: calls, of subworkflows, and so on. An empty list produces an empty result, and downstream steps still run.
Repeat until a condition holds (loop)
loop: repeats a step. until: is checked after each round against output, that round’s result. {{ round }} is the round number and {{ last }} is the previous round’s output. If maxRounds runs out before until is met, the step fails.
until to loop a fixed number of times:
Reliability
Output contracts
Attach anoutput_schema (a JSON Schema object) to a prompt or agent step to enforce the shape of the reply. You don’t need to describe the JSON format in the prompt text: the requested shape is given to the model, and the reply is parsed and validated before downstream steps use it. Set retries to retry a failed step; a reply that still fails validation fails the step.
Per-step model overrides
prompt and agent steps accept optional provider: and model: to switch the model for that step only. The switch lasts for the run; your saved model configuration is untouched. Use a cheap model for bulk steps and a stronger one where it matters.
Set provider to the installed provider command name and model to a model ID shown by that provider in your current build. For example, copy both values from your working provider configuration into the prompt step. Model availability and permissions are account-specific; the examples on this page use your configured default model.
provider is a provider command (for example enconvo_ai, open_ai, or ollama) and model is a model ID for that provider. Both are valid only on prompt and agent steps.Subworkflows
Compose workflows withuses: workflow, either by workflowId: (a saved workflow) or with an inline workflow: block. The step’s output is the child run result. Reference the child’s step outputs with output.outputs['job.step']:
Templates reference
Templates support Nunjucks filters (
| trim, | int, | dump, | default(...), {% for %}, and others), which is how you reshape data between steps.
Complete examples
Research, summarize, and report
Search the web, summarize the findings, and assemble a Markdown report. The steps run in order within one job, so noneeds wiring is required:
Conditional routing
Approve or reject based on a score, then always write a final report:Loop until converged
Refine a draft repeatedly until a self-check approves it, capping the rounds:Related
Creating Workflows
The editor, the editing assistant, and every step type.
Workflows
Jobs, steps, and how workflows are run.