> ## Documentation Index
> Fetch the complete documentation index at: https://spacesail.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Branching Workflow

> Complex decision trees requiring dynamic path selection based on content analysis

**Example Use-Cases**: Expert routing, content type detection, multi-path processing

Dynamic routing workflows provide intelligent path selection while maintaining predictable execution within each chosen branch.

<img className="block dark:hidden" src="https://mintcdn.com/spacesail/j6oZ21rFI_VtZleU/images/workflows-router-steps-light.png?fit=max&auto=format&n=j6oZ21rFI_VtZleU&q=85&s=b248407d4ae960d22fd50f6bd97ce3bb" alt="Workflows router steps diagram" width="2493" height="921" data-path="images/workflows-router-steps-light.png" />

<img className="hidden dark:block" src="https://mintcdn.com/spacesail/j6oZ21rFI_VtZleU/images/workflows-router-steps.png?fit=max&auto=format&n=j6oZ21rFI_VtZleU&q=85&s=ac15a64e680ff89a7ab1f1a77f9aec16" alt="Workflows router steps diagram" width="2493" height="921" data-path="images/workflows-router-steps.png" />

## Example

```python branching_workflow.py theme={null}
from agno.workflow import Router, Step, Workflow

def route_by_topic(step_input) -> List[Step]:
    topic = step_input.input.lower()

    if "tech" in topic:
        return [Step(name="Tech Research", agent=tech_expert)]
    elif "business" in topic:
        return [Step(name="Business Research", agent=biz_expert)]
    else:
        return [Step(name="General Research", agent=generalist)]

workflow = Workflow(
    name="Expert Routing",
    steps=[
        Router(
            name="Topic Router",
            selector=route_by_topic,
            choices=[tech_step, business_step, general_step]
        ),
        Step(name="Synthesis", agent=synthesizer),
    ]
)

workflow.print_response("Latest developments in artificial intelligence and machine learning", markdown=True)
```

## Developer Resources

* [Router Steps Workflow](/examples/concepts/workflows/05_workflows_conditional_branching/router_steps_workflow)

## Reference

For complete API documentation, see [Router Steps Reference](/reference/workflows/router-steps).
