Skip to main content
Example use cases: Expert routing, content type detection, multi-path processing A Router uses a selector function to decide at runtime which of its choices to execute. Multiple selected choices run sequentially. A selected Parallel, Loop, or other container applies its own control flow. Workflows router steps diagram

Selector Flexibility

The Router selector function supports multiple return types: The selector can also receive step_choices as an optional second parameter for dynamic selection, or be a CEL expression string that returns a step name.

Example: String-based Selector

The simplest approach is to return the step name as a string:
branching_workflow.py

Example: Using step_choices Parameter

Access available choices dynamically for more flexible routing:
dynamic_routing.py

Example: Nested Choices

Nested lists in choices become Steps containers for sequential execution:
nested_routing.py

Developer Resources

Reference

For complete API documentation, see Router Steps Reference.