By default, each workflow step runs in sequence and passes its output to the next step. Routing rules let you alter that flow based on the engine’s output or a fixed condition.
Rule structure
Each routing rule has three fields:
| Field | Description |
|---|
| Action | What to do: continue, retry:N, or skip |
| Trigger | When to apply the action: auto or a keyword/phrase to match in the step’s output |
| Condition | Optional: contains, does_not_contain, always |
Actions
continue
Move to the next step immediately. This is the default behaviour — adding an explicit continue rule lets you attach a trigger condition to it.Example: Continue only if the output contains “APPROVED”:Action: continue
Trigger: APPROVED
Condition: contains
retry:N
Re-run the current step up to N times. Useful for quality gates where the engine should keep trying until a condition is met.N can be 1–5. If the step has not satisfied the trigger after N retries, the workflow continues anyway.Example: Retry up to 3 times if the output does not contain a Markdown table:Action: retry:3
Trigger: |-----|
Condition: does_not_contain
skip
Skip the next step and jump to the step after it. Useful for optional enrichment steps that should only run when the upstream output meets a condition.Example: Skip the “Risk Flags” step if the document does not contain the word “liability”:Action: skip
Trigger: liability
Condition: does_not_contain
Auto trigger
Set Trigger to auto to apply the action unconditionally at the end of the step.
Action: continue
Trigger: auto
This is equivalent to the default step behaviour.
Multiple rules
A step can have multiple routing rules. MIRA evaluates them top-to-bottom and applies the first rule whose condition is satisfied. If no rule matches, the default continue behaviour applies.
Routing rules operate on the raw text output of a step. If your step produces structured output (JSON, Markdown tables), use a substring from that structure as your trigger keyword.
Example: Quality gate with retry
This configuration retries the “Summarise” step up to two times if the output is shorter than expected:
Step: Summarise findings
Instructions: Summarise the research into exactly 5 bullet points. {{prev_output}}
Routing rules:
1. Action: retry:2 | Trigger: "- " | Condition: does_not_contain
2. Action: continue | Trigger: auto