router
The Router block uses AI to intelligently decide which path your workflow should take next. Unlike Condition blocks that use simple rules, Router blocks can understand context and make smart routing decisions based on content analysis.
Overview
Router vs Condition Blocks
How It Works
The Router block:
Configuration Options
Content/Prompt
The content or prompt that the Router will analyze to make routing decisions. This can be:
A direct user query or input
Output from a previous block
A system-generated message
Target Blocks
The possible destination blocks that the Router can select from. The Router will automatically detect connected blocks, but you can also:
Customize the descriptions of target blocks to improve routing accuracy
Specify routing criteria for each target block
Exclude certain blocks from being considered as routing targets
Model Selection
Choose an AI model to power the routing decision:
OpenAI: GPT-4o, o1, o3, o4-mini, gpt-4.1 Anthropic: Claude 3.7 Sonnet Google: Gemini 2.5 Pro, Gemini 2.0 Flash Other Providers: Groq, Cerebras, xAI, DeepSeek Local Models: Any model running on Ollama
Recommendation: Use models with strong reasoning capabilities like GPT-4o or Claude 3.7 Sonnet for more accurate routing decisions.
API Key
Your API key for the selected LLM provider. This is securely stored and used for authentication.
Accessing Results
After a router makes a decision, you can access its outputs:
<router.content>: Summary of the routing decision made<router.selected_path>: Details of the chosen destination block<router.tokens>: Token usage statistics from the LLM<router.model>: The model used for decision-making
Advanced Features
Custom Routing Criteria
Define specific criteria for each target block:
Multi-Model Routing
Use different models for different routing scenarios:
Fallback Handling
Implement robust fallback mechanisms:
Inputs and Outputs
Content/Prompt: Text to analyze for routing decisions
Target Blocks: Connected blocks as potential destinations
Model: AI model for routing analysis
API Key: Authentication for selected LLM provider
router.content: Summary of routing decision
router.selected_path: Details of chosen destination
router.tokens: Token usage statistics
router.model: Model used for decision-making
Routing Decision: Primary path selection result
Decision Context: Analysis summary and reasoning
Access: Available in blocks after the router
Example Use Cases
Customer Support Triage
Content Classification
Lead Qualification
Example
Router prompt:
Best Practices
Provide clear target descriptions: Help the Router understand when to select each destination with specific, detailed descriptions
Use specific routing criteria: Define clear conditions and examples for each path to improve accuracy
Implement fallback paths: Connect a default destination for when no specific path is appropriate
Test with diverse inputs: Ensure the Router handles various input types, edge cases, and unexpected content
Monitor routing performance: Review routing decisions regularly and refine criteria based on actual usage patterns
Choose appropriate models: Use models with strong reasoning capabilities for complex routing decisions
Was this helpful?
