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

# Router with Step Choices

> Router step_choices parameter and string, Step, and List[Step] returns.

The `step_choices` parameter provides ultimate flexibility for dynamic routing, allowing Router selectors to return strings, Step objects, or lists of Steps for chained execution. It enables complex logic where available paths are inspected at runtime rather than hard-coded.

## Key Benefits

When your routing logic needs flexible return types or dynamic access to available choices, `step_choices` is the right tool.

1. **Flexible Returns**: Return string names, Step objects, or lists as needed
2. **Dynamic Selection**: Use `step_choices` to inspect available options at runtime
3. **Step Chaining**: Return `List[Step]` to execute multiple steps in sequence
4. **Nested Containers**: Use nested lists in choices for grouped sequential execution
5. **Reusable Logic**: Build routing functions that adapt to any set of choices

## Selector Return Types Summary

| Return Type  | Description                              | Example                                 |
| ------------ | ---------------------------------------- | --------------------------------------- |
| `str`        | Step name - Router resolves from choices | `return "Tech Research"`                |
| `Step`       | Step object directly                     | `return step_map["writer"]`             |
| `List[Step]` | Chain multiple steps                     | `return [researcher, writer, reviewer]` |

## Examples

<CardGroup cols={2}>
  <Card title="String Selector" icon="code" href="/workflows/usage/examples/router-choices/string-selector">
    Return step names as strings for simple resolution.
  </Card>

  <Card title="Dynamic Selector" icon="code" href="/workflows/usage/examples/router-choices/dynamic-selector">
    Inspect `step_choices` to dynamically select steps.
  </Card>

  <Card title="Nested Selector" icon="code" href="/workflows/usage/examples/router-choices/nested-selector">
    Select nested lists of steps as a single unit.
  </Card>
</CardGroup>

## Developer Resources

* [Router Steps Reference](/reference/workflows/router-steps)
* [Conditional Branching Workflow](/workflows/usage/router-steps-workflow)
* [Router with Loop Steps](/workflows/usage/router-with-loop-steps)
