Skip to main content

Use Outcome Routing

Configure stage outcomes to create branching and looping patterns in your workflow. Outcome routing lets a stage direct execution to different stages based on its result.

Prerequisites

Steps

1. Open the stage's Routing tab

Navigate to the Visual Builder and click a stage node. In the edit drawer, switch to the Routing tab (tab 1).

Routing tab in stage drawer

2. Define outcomes

Add outcome names that the stage can produce. Outcomes are strings that the finalizer agent (or the last agent to produce output) sets as the stage's result.

Example outcomes for a review stage:

  • approved -- Content passes quality review
  • needs_revision -- Content requires changes
  • rejected -- Content is fundamentally flawed

Click Add Outcome and type each outcome name. Outcomes are case-sensitive.

tip

Keep outcome names short and descriptive. They appear as labels on routing links in the Visual Builder.

3. Configure outcome routing

For each outcome, select the target stage from the dropdown. This determines where the workflow goes when that outcome is produced.

OutcomeTarget StageEffect
approvedPublish (stage 3)Skips ahead to publishing
needs_revisionDraft (stage 1)Loops back to redraft
rejected(none)Falls through to the next sequential stage

Outcomes without explicit routing default to the next stage in position order.

4. Set up a loop guard

When routing creates a backward loop (e.g., from Review back to Draft), set a Loop Guard to prevent infinite loops.

The loop guard specifies the maximum number of times a stage can loop back before the workflow forces forward progression.

Loop guard configuration

warning

Always set a loop guard when creating backward routes. Without one, a workflow can loop indefinitely if the outcome condition is never met.

5. View routing in the Visual Builder

After saving, the Visual Builder shows routing visually:

  • A diamond node (decision point) appears below the stage
  • Labeled dashed links branch from the diamond to target stages, each showing the outcome name as an amber pill badge
  • Backward routes (to earlier stages) use manhattan routing with curved connectors along the right side of the canvas

Outcome routing in Visual Builder

6. Add routing via drag-and-drop

Alternatively, drag a "Router" card from the Routing section of the sidebar palette onto a stage node. This opens the stage drawer with the Routing tab pre-selected.

In the Visual Builder:

  • Click a diamond node to open the stage's Routing tab
  • Click an outcome label on a link to open the same tab

8. Common routing patterns

Linear pipeline (default): No outcomes defined. Stages execute in position order.

Quality gate: A review stage with approved and needs_revision outcomes. Approved content advances; rejected content loops back.

Multi-path branching: A classification stage routes to different processing stages based on content type (e.g., text goes to stage A, image goes to stage B).

Retry with escalation: First attempt loops back on failure, but after the loop guard limit, the workflow falls through to an error-handling stage.

What's next

Learn more