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

1

Intelligent content routing

Use AI to understand intent and context

2

Dynamic path selection

Route workflows based on unstructured content analysis

3

Context-aware decisions

Make smart routing choices beyond simple rules

4

Multi-path management

Handle complex workflows with multiple potential destinations

Router vs Condition Blocks

When to Use Router
  • AI-powered content analysis needed

  • Unstructured or varying content types

  • Intent-based routing (e.g., "route support tickets to departments")

  • Context-aware decision making required

When to Use Condition
  • Simple, rule-based decisions

  • Structured data or numeric comparisons

  • Fast, deterministic routing needed

  • Boolean logic sufficient

How It Works

The Router block:

1

Analyze content

Uses an LLM to understand input content and context

2

Evaluate targets

Compares content against available destination blocks

3

Select destination

Identifies the most appropriate path based on intent

4

Route execution

Directs workflow to the selected 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

Example Use Cases

Customer Support Triage

1

Scenario: Route support tickets to specialized departments

  1. User submits support request via form

  2. Router analyzes ticket content and context

  3. Technical issues → Engineering support agent

  4. Billing questions → Finance support agent

Content Classification

1

Scenario: Classify and route user-generated content

  1. User submits content or feedback

  2. Router analyzes content type and sentiment

  3. Feature requests → Product team workflow

  4. Bug reports → Technical support workflow

Lead Qualification

1

Scenario: Route leads based on qualification criteria

  1. Lead information captured from form

  2. Router analyzes company size, industry, and needs

  3. Enterprise leads → Sales team with custom pricing

  4. SMB leads → Self-service onboarding flow

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?