Repository navigation
Conditional Routing
Sudhanshu edited this page Nov 11, 2026
·
1 revision
flowchart TD
START([START]) --> ADD["Add_Node: input + 10"]
ADD --> ROUTER{"number > 50?"}
ROUTER -->|Yes: multiply| MUL["Multiply_Node: number * 2"]
ROUTER -->|No: subtract| SUB["Subtract_Node: number - 5"]
MUL --> END([END])
SUB --> END
route_based_on_value(number) returns multiply when the post-addition state is greater than 50, otherwise subtract. Input 45 becomes 55 then 110; input 20 becomes 30 then 25.
The router is attached via builder.add_conditional_edges("Add_Node", route_based_on_value, {...}), and each branch ends at END.
Change the threshold or provide additional input values to test routing, but keep branch keys and mapping synchronized.
Multi-Agent Workflows using LangGraph · Home · Architecture · LLD · Security. This project is licensed under the Apache License, Version 2.0.© 2026 Sudhanshu Shukla · Licensed under the Apache License, Version 2.0.
Navigation
- Home
- Installation and Quickstart
- Repository Layout
- Graph Examples
- Architecture
- Implementation
- Operations
- Design Tradeoffs
- Future Enhancements
- Changes from Upload