---
title: Branching
description: Split a workflow into different paths based on the result of a step — the Condition block decides with a rule, the Router lets a model decide.
---

import { VideoPlaceholder } from '@/components/ui/video-placeholder'
import { WhatYouWillLearn } from '@/components/ui/what-you-will-learn'
import { VideoChapters } from '@/components/ui/video-chapters'
import { WorkflowPreview, CONDITION_ROUTE_WORKFLOW } from '@/components/workflow-preview'

<VideoPlaceholder eyebrow="Workflows" title="Branching" src="https://nnjgp7vypgx4myuq.public.blob.vercel-storage.com/academy-preview/workflows-branching-light-with-intro.mp4" className="mt-2" />

<div className="mt-8 grid grid-cols-1 items-start gap-10 lg:grid-cols-[1fr_300px]">
<div>

Branching is how a workflow **splits into different paths based on the result of a step**. Sim gives you two blocks for it — the **Condition** block, which decides with an explicit rule, and the **Router**, which lets a model decide from intent.

<WhatYouWillLearn
  items={[
    {
      title: 'Branching the flow',
      body: 'After a step produces a result, branching sends the run down one path or another instead of straight through.',
    },
    {
      title: 'Condition: decide with a rule',
      body: 'The Condition block picks a branch from an explicit rule you write, a comparison over an earlier output.',
    },
    {
      title: 'Router: let a model decide',
      body: 'The Router reads the input and chooses a branch from natural-language intent, for when the rule is fuzzy.',
    },
  ]}
/>

</div>

<VideoChapters
  chapters={[
    { title: 'Introduction', time: '0:00' },
    { title: 'Branching the flow', time: '0:24' },
    { title: 'The Condition block', time: '0:32' },
    { title: 'If, else if, else', time: '0:46' },
    { title: 'Switching to a Router', time: '0:55' },
    { title: 'The Router block', time: '1:05' },
    { title: 'Seeing it in the logs', time: '1:17' },
    { title: 'Recap', time: '1:26' },
  ]}
/>

</div>

## A fork in the flow

Most workflows you've seen run in a line. Branching adds a **fork**: at some point the run looks at the result of a step and takes one path or another. The paths can do completely different work.

Here's the shape of a fork — one step decides, and the run takes one path or the other:

<WorkflowPreview workflow={CONDITION_ROUTE_WORKFLOW} />

## The Condition block — decide with a rule

The **Condition** block branches on an **explicit rule** — a comparison over an earlier block's output, like priority equals "high". The matching branch runs; the others don't. It's deterministic and predictable.

## The Router block — let a model decide

Sometimes the rule is fuzzy: "send billing questions one way, everything else another." The **Router** block hands the decision to a **model** — it reads the input, picks the branch that matches the intent, and the run continues down it. Same fork, but the decider is reasoning instead of a fixed rule.

## Still one workflow

Whichever way it forks, it's **still one workflow**, and every run is recorded. Open the logs and you can see exactly which path a given run took, and why.

## Related documentation

- [How workflows run](/workflows/how-it-runs)
- [Condition block](/workflows/blocks/condition)
- [Router block](/workflows/blocks/router)
