Router with Step Choices

Use the Router step_choices parameter with string, step, and list selector returns.

A Router selector can declare a step_choices parameter. The router passes its prepared choices to that parameter. The selector can return a choice name, a step object, or a list of choices to run in sequence.

Selection options

Use step_choices to inspect the prepared choices at runtime. Return a list to run several choices in sequence. A nested list in choices is prepared as a grouped Steps container.

Selector Return Types Summary

Return TypeDescriptionExample
strStep name - Router resolves from choicesreturn "Tech Research"
StepStep object directlyreturn step_map["writer"]
List[Step] or List[str]Run multiple choices in sequencereturn [researcher, writer, reviewer]

Examples

Developer Resources