Conditional Nodes
Switch Node
The Switch Node enables multi-branch conditional routing with complex conditions. Key Features:- Multiple condition paths
- Complex condition builder
- Default fallback path
- Priority-based evaluation (top to bottom)
- Multi-way decisions (if/elif/elif/else)
- Routing based on categories
- Complex business logic
- State machines
Conditional Node
The Conditional Node provides simple if/else branching. Key Features:- Two paths: true and false
- Single condition
- Simpler than Switch for binary decisions
- Yes/no decisions
- Binary states
- Simple validation checks
Connecting branches in V2
To run a step only on a branch, connect that branch’s output handle to the step. When building through the API, set the edge’ssource_handle to when_true, when_false, or the Switch branch ID. Validation rejects routing edges that omit this field. Use output explicitly for a data dependency without branch gating. Putting a branch-handle reference in a Combine Text template does not gate execution.
Multiple handles connected directly from the same routing node combine with OR: the receiving step can run when any connected handle fires, provided its other sources are live. For example, connecting both Conditional handles directly to one step allows it to run for either outcome.
An ordinary step skips when any distinct source is dead. If each mutually exclusive branch has its own processing step, connect those steps to Join Paths (MergePathsNode) before continuing. Join Paths skips only when all its sources are dead.
Building Conditions
Condition Builder
Both Switch and Conditional nodes use a visual condition builder: Components:- Left Value: The data to evaluate
- Operator: Comparison type
- Right Value: Value to compare against
Operators
Text Operators:equals: Exact matchnot equals: Not an exact matchcontains: Substring matchnot contains: Doesn’t contain substringstarts with: Begins with textends with: Ends with textmatches regex: Regex pattern matchis empty: Empty string or nullis not empty: Has value
equals: Equal tonot equals: Not equal togreater than: >less than: <greater than or equal: >=less than or equal: <=
is true: Value is trueis false: Value is false
contains: List contains itemnot contains: List doesn’t contain itemis empty: Empty listis not empty: Has itemslength equals: List length equals numberlength greater than: List length > numberlength less than: List length < number
Complex Conditions
Combine multiple conditions with AND/OR logic: AND Condition (all must be true):Switch Node Patterns
Basic Multi-Way Branching
Example: Customer Type RoutingPriority Evaluation
Conditions are evaluated top to bottom, first match wins:Category-Based Routing
Example: Support Ticket RoutingState Machine Pattern
Example: Order Status ProcessingConditional Node Patterns
Simple Validation
Example: Email ValidationThreshold Checking
Example: Approval WorkflowNull/Empty Checking
Example: Optional Field HandlingCommon Patterns
Pattern 1: Validation Chain
Multiple validation checks in sequence:Pattern 2: Early Exit
Check for error conditions early and exit:Pattern 3: Confidence-Based Routing
Route based on AI confidence scores:Pattern 4: Feature Flags
Enable/disable features dynamically:Pattern 5: A/B Testing
Route to different logic for testing:Advanced Techniques
Chaining Conditionals
Combine multiple conditionals for complex logic:Computed Conditions
Use data from previous nodes in conditions:Dynamic Routing Table
Use data lookup for routing decisions:Working with Lists
List-Based Conditions
Conditionals work with list data:Filtering Lists
Use Filter List node for list-based conditionals:Conditional List Processing
Apply different processing based on list characteristics:Error Handling with Conditionals
Check for Errors
Retry Logic
Fallback Logic
Debugging Conditionals
Common Issues
Condition Never True:- Check data types (string “1” vs number 1)
- Verify exact spelling and casing
- Use log nodes to inspect actual values
- Check condition order in Switch node
- Verify AND/OR logic
- Test with known values
- Add explicit null checks
- Use “is empty” / “is not empty” operators
- Provide default values upstream
Testing Tips
Use Test Data:- Test with known values that should match each path
- Verify all branches are reachable
- Add Log Value nodes before conditionals
- Inspect actual data types and values
- Verify condition variables exist
- Test with null/empty values
- Test with extreme values (very large, very small)
- Test with unexpected data types
Best Practices
Design
Keep Conditions Simple: Complex conditions are hard to debug Use Descriptive Names: Name conditional paths clearly Avoid Deep Nesting: More than 3 levels of nesting is hard to follow Prefer Switch Over Chained Conditionals: For 3+ branches, use Switch node Handle Default Cases: Always include default/fallback pathsPerformance
Early Exit: Check expensive conditions last Compute Once: Store computed values, don’t recalculate in each condition Minimize Branching: Fewer branches = simpler workflowsMaintainability
Document Complex Logic: Add comments to workflows explaining business rules Use Subflows: Extract complex conditional logic into subflows Centralize Rules: Consider storing rules in databases/config for easy updatesExample Workflows
Example 1: Lead Scoring and Routing
Example 2: Invoice Approval Workflow
Example 3: Content Moderation
Next Steps
Loops
Iterate with loop control
Subflows
Modular workflow components
Error Handling
Graceful error recovery
List Handling
Automatic list iteration
Conditionals are essential for building intelligent, dynamic workflows that adapt to data and make decisions automatically.