AI / CrewAI Interview Questions
What is the @router decorator in CrewAI Flows?
The @router decorator marks a method used for conditional routing, letting a Flow branch down different paths depending on the output of a previous step.
- Evaluates a condition and determines which subsequent path the Flow should follow
- Can be combined with logical operators like and_ or or_ for more complex triggering conditions
- Lets a single Flow handle multiple possible outcomes, like success versus failure, without needing entirely separate Flow definitions
This decorator is what turns a Flow from a straight-line sequence into a genuine decision tree of possible execution paths.
More Related questions...