AI Router
Use AI to intelligently route workflow execution based on prompt analysis
Node Type
Conditional
Category
AI & Logic
Icon
AI Brain
Overview
The AI Router node is a powerful conditional node that uses Large Language Models (LLMs) to analyze prompts and intelligently select which downstream node to follow. Instead of traditional rule-based routing, this node leverages AI to understand context and make smart decisions about workflow execution paths.
Key Features
- • AI-Powered Routing: Uses LLMs to analyze prompts and select optimal execution paths
- • Dynamic Node Analysis: Automatically discovers and analyzes available downstream nodes
- • Letter-Based Selection: Maps downstream nodes to letters (A, B, C, D...) for easy AI reference
- • Flexible Execution: Option to allow no execution if no suitable path exists
- • Context-Aware Decisions: Considers node descriptions, types, and categories when routing
- • Cost Tracking: Monitors LLM usage costs for optimization
Prerequisites
AI Service Access
Must have access to LLM services
Workflow Structure
Must have multiple downstream paths
Routing Strategy
Understanding of AI-based decision making
Node Configuration
Required Fields
Prompt
The prompt or context the AI will analyze to determine routing. Should clearly describe the situation, data, or condition that will inform the routing decision.
Optional Fields
Allow No Execution
If true, allows the AI to choose not to execute any downstream node. If false, the AI must select one of the available paths.
Examples & Use Cases
Customer Support Routing
Route customer inquiries to appropriate departments
{
"prompt": "Customer message: {{customerMessage}}. Route to the most appropriate department.",
"allowNoExecution": false
}Downstream nodes: A) Sales Team, B) Technical Support, C) Billing Department. AI analyzes the customer message and routes to the best department.
Content Classification
Classify and route content based on type or sentiment
{
"prompt": "Email content: {{emailBody}}. Classify as urgent, regular, or spam.",
"allowNoExecution": true
}Routes emails to: A) Urgent Processing, B) Regular Inbox, C) Spam Filter, or no action if uncertain.
Dynamic Workflow Selection
Choose different processing pipelines based on data characteristics
{
"prompt": "Data type: {{dataType}}, size: {{dataSize}}, priority: {{priority}}. Select optimal processing pipeline.",
"allowNoExecution": false
}Routes to: A) Fast Processing, B) Detailed Analysis, C) Batch Processing based on data characteristics.
Best Practices
Do's
- • Provide clear, descriptive prompts with relevant context
- • Give downstream nodes meaningful names and descriptions
- • Use the reasoning output for debugging and optimization
- • Monitor costs to optimize AI usage
- • Test with various scenarios to ensure reliable routing
- • Consider using allowNoExecution for uncertain cases
Don'ts
- • Don't use vague or ambiguous prompts
- • Avoid having too many downstream paths (limit to 4-6)
- • Don't forget to provide context in the prompt
- • Avoid using when simple If-Else would suffice
- • Don't ignore the cost implications of frequent AI routing
- • Avoid unclear node names that confuse the AI
Troubleshooting
Common Issues
Inconsistent Routing
Symptoms: AI selects different paths for similar inputs
Solution: Make prompts more specific and provide more context. The AI's probabilistic nature means some variation is normal, but clear prompts reduce inconsistency.
Wrong Path Selected
Symptoms: AI consistently chooses inappropriate paths
Solution: Improve downstream node descriptions to help the AI understand each path's purpose. Add more context to the prompt about what criteria should drive the decision.
High Costs
Symptoms: Routing operations are expensive
Solution: Consider using If-Else nodes for simple conditions and reserve AI Router for complex decisions. Monitor the cost output and optimize prompt length.