Router
This document explains the Router node, which enables smart conditional routing in your workflows by directing data through different paths based on AI decisions or logical conditions.
What Does the Router Node Do?
The Router node acts as a decision point in your workflow, allowing you to split your flow into multiple paths and automatically choose which path to follow based on your configuration. Think of it like an if-else statement, but much more powerful - instead of just two paths (if/else), you can create up to 8 different routes and use AI to make intelligent routing decisions.
Real-World Example: If you’re building a flow that processes incoming support tickets, you might want to:
- Route urgent tickets to your escalation team
- Send billing questions to your finance department
- Direct general inquiries to your standard support queue
The Router node evaluates each ticket and automatically sends it down the appropriate path based on the conditions you define.
Real-World Workflow Examples
Understanding the Router node is easier with concrete examples. Here are two workflows that demonstrate the key differences between AI and standard routing:
Lead Website Analyzer (Standard Routing)
This workflow uses logical conditions to qualify leads by detecting website technology.
How it works:
- Sheet Reader → Reads prospect websites from Google Sheet
- Website Scraper → Scrapes each website to get content
- Router (Standard Mode) → Uses text conditions to detect platforms
- Actions → Routes qualified leads to Slack, others to Gmail rejection
Router Configuration:
Why Standard Routing: This is deterministic - if the scraped content contains specific Shopify keywords, it’s definitely a Shopify store. No interpretation needed, just exact keyword matching.
Support Request Triage (AI Routing)
This workflow uses AI-powered routing to intelligently categorize support requests.
How it works:
- Gmail Reader → Reads support emails from a specific label
- Router (AI Mode) → Uses AI to understand intent and urgency
- Actions → Routes to appropriate teams and systems
Router Configuration:
Why AI Routing: This requires interpretation - the AI needs to understand context, tone, and intent to determine urgency and category. Keywords alone aren’t enough hence logical/standard routing method won’t be the best option.
Key Differences
Aspect | Lead Analyzer (Standard Routing) | Support Triage (AI Routing) |
---|---|---|
Decision Logic | Keyword detection | Content interpretation |
Routing Basis | Exact text matches | Context and intent |
Consistency | 100% deterministic | Intelligent but may vary |
Use Case | Clear yes/no criteria | Nuanced categorization |
Common Elements
Both workflows demonstrate important Router concepts:
- Loop Mode: Processing multiple items individually
- Fallback Routes: Catching unmatched items
- Multiple Actions: Different routes trigger different responses
These examples show when to choose each routing mode based on your specific needs.
Node Inputs
Input to Evaluate
The specific data that the Router uses to make routing decisions. This is the field that gets analyzed to determine which route to take.
Example: If you’re processing support tickets, you might choose:
ticket_description
- to route based on the content of the issue
Routes
The different paths your data can follow (maximum 8 routes). Each route represents a different outcome or processing path.
Example: For a support ticket system:
- Route 1: “Urgent”
- Route 2: “Billing Question”
- Route 3: “Technical Support”
- Route 4: “General Inquiry”
Optional Fields
Route With AI
Toggle between AI-powered routing and standard logical routing. This is enabled by default - you’ll need to turn it off if you want to use standard logical routing instead.
Example:
- AI Mode (Default): Let AI decide if an email is a “complaint” vs “compliment” based on content
- Standard Mode: Use logical conditions like “if priority equals ‘high’ then route to urgent”
AI Model Selection
Choose which AI model to use for routing decisions (only available when AI mode is enabled).
Node Outputs
The Router node creates branches - separate output paths for each route you define. Each branch contains all the inputs that were passed into the Router node, not just the input you’re evaluating.
How Outputs Work
Key Point: Every route gets access to all the input data, but only one route will be active per item.
Example Setup:
- Inputs to Router:
ticket_description
,ticket_title
,ticket_link
,customer_email
- Input to Evaluate:
ticket_description
(this determines the routing) - Routes: “Urgent”, “Billing Question”, “Technical Support”
Resulting Outputs: Each route creates a separate branch with all the input data.
Visual Representation
Connecting Outputs
After the Router, you can connect each branch to different nodes:
Each downstream node receives all the input data for the items that were routed to that branch.
Important Notes
- All Data Available: Every route has access to all input data, not just the evaluation input
- Selective Activation: Only one route per item will be active and pass data through
- Preserve Context: All related information stays together through the routing process
Routing Modes
AI Routing Mode (Recommended)
AI routing uses natural language to make intelligent routing decisions based on context and content understanding.
How It Works
- Input Selection: Choose which input data the AI should evaluate
- Route Definition: Create routes with descriptive names
- AI Conditions: Describe when each route should be used (optional but recommended)
- Model Selection: Choose an AI model for decision-making
Configuration Example
Best Practices for AI Routing
-
Use Descriptive Route Names: Even without AI conditions, the AI can often infer routing logic from clear route names
-
Provide Clear AI Conditions: Give the AI enough information to make accurate decisions
- Choose the Right AI Model: Use more powerful models for complex routing decisions
Standard Routing Mode
Standard routing uses logical conditions and boolean operators for precise, rule-based routing. This mode is best when you have clear, measurable criteria for routing decisions.
How It Works
- Route Definition: Create named routes for different paths
- Condition Building: Set up logical conditions using the condition dropdown
- Boolean Logic: Combine conditions with AND/OR operators within each route
- Sequential Evaluation: Routes are evaluated in order from top to bottom - first match wins
Supported Condition Types
Condition | Description |
---|---|
General Conditions | |
Is empty | Field is empty or null |
Is not empty | Field has content |
Text Conditions | |
[Text] Equals | Exact text match (case-sensitive) |
[Text] Does not equal | Text is not an exact match |
[Text] Contains | Text includes substring |
[Text] Does not contain | Text does not include substring |
[Text] Starts with | Text begins with specific string |
[Text] Does not start with | Text does not begin with string |
[Text] Ends with | Text ends with specific string |
[Text] Does not end with | Text does not end with string |
[Text] Is in | Checks if your entire text value appears anywhere inside the condition text |
[Text] Is not in | Checks if your entire text value does NOT appear anywhere inside the condition text |
[Text] Is greater than [n] characters | Text length exceeds specified number |
[Text] Is less than [n] characters | Text length is under specified number |
[Text] Matches regex | Text matches regular expression pattern |
[Text] Does not match regex | Text does not match regex pattern |
Number Conditions | |
[Number] Equals | Exact number match |
[Number] Is not equal to | Number is not exact match |
[Number] Is greater than | Number is larger than value |
[Number] Is less than | Number is smaller than value |
[Number] Is greater than or equal to | Number is greater than or equal to value |
[Number] Is less than or equal to | Number is less than or equal to value |
Understanding Route Evaluation Order
Routes are evaluated sequentially from top to bottom. The first route that matches will be selected.
Example: If you have routes for “High Priority” and “Medium Priority”, and an item matches both conditions, it will go to “High Priority” because it appears first in the list.
Key Point: Order your routes from most specific to most general, with a catch-all route at the bottom.
Loop Mode Processing
The Router automatically enables Loop Mode when it detects list inputs.
Loop Mode ON (Default for Lists)
How it works: Each item in the list is evaluated individually and routed separately.
Example: Loop Mode On Workflow
Notes
Input Validation
The Router performs comprehensive validation:
- Type Consistency: All inputs that you’re evaluating must be the same type (text or list)
- List Size Matching: All list inputs must have identical lengths
Credit Management
- Standard Routing: 0 credits (logic-based, no external APIs)
- AI Routing: Credits are charged based on the AI model being used:
- Standard models: 2 credits
- Advanced models: 20 credits
- Expert models: 30 credits
Router vs If-Else Logic
The Router node works like if-else statements in programming, but with significant enhancements:
Traditional If-Else | Router Node | |
---|---|---|
Paths | 2 paths (if/else) | Up to 8 routes |
Decision Making | Basic logical conditions | AI-powered + logical conditions |
Complexity | Simple true/false | Complex multi-path routing |
Batch Processing | Basic | Optimized for single inputs + lists |
Visual Clarity | Generic true/false | Clear route names |
Troubleshooting
Common Issues
-
“No route matched” Error
- Solution: Add a fallback route that catches unmatched items
- Prevention: Test with edge cases and unexpected values
-
“Input type mismatch” Error
- Solution: Ensure all inputs are the same type (text or list)
- Prevention: Use data type conversion nodes before the Router
- More info on type mismatch available here.
-
“List size mismatch” Error
- Solution: Ensure all list inputs have the same length
- Prevention: Use Duplicate node to match list sizes
- More info on list size mismatch available here.
Debugging Tips
- Test with Simple Cases: Start with clear-cut examples
- Monitor Run Logs: Check which routes are being selected
- Use Descriptive Names: Makes debugging easier
- Validate Inputs: Ensure input data is clean and expected format
Best Practices Summary
General Guidelines
- Start Simple: Begin with 2-3 routes and add complexity as needed
- Test Thoroughly: Validate routing decisions with sample data
- Use Descriptive Names: Clear route names improve maintainability
- Always Include a Fallback Route: Add a route with no conditions to catch unmatched items
- Order Routes by Priority: Place most specific conditions first, general conditions last
AI Routing Specific
- Choose Appropriate Models: Match model complexity to routing difficulty
- Provide Context: Give AI enough information to make accurate decisions
- Use Examples: Include examples in AI conditions when possible
- Test Consistency: Verify AI makes consistent routing decisions
Standard Routing Specific
- Order by Specificity: Most specific conditions first
- Use Logical Grouping: Combine related conditions effectively
- Validate Data Types: Ensure inputs match expected formats
The Router node is a powerful workflow control component that enables intelligent, conditional routing of data through multiple paths. Whether you need simple logical routing or complex AI-powered decisions, the Router node provides the flexibility and power to create sophisticated automation workflows.
Need Help?
If you’re stuck or have questions about using the Router node, don’t hesitate to reach out:
- Community Forum: Get help from other users at forum.gumloop.com
- Example Workflows: Check out the Lead Analyzer and Support Triage workflows for inspiration