New260+ blocks and 240+ tools are now fully documented
DocumentationReferenceCore BlocksFlow Control
Block

Router Block

Route workflow execution to different paths based on AI-powered input analysis

Intelligently directs workflow execution to different paths based on input analysis. Use an AI model to determine the most appropriate next block in your workflow based on content, intent, or any criteria you express in a prompt.

Overview

PropertyValue
Typerouter
Categoryblocks
Color#28C43F

When to Use

  • You need to fan out to 3 or more different workflow branches based on AI classification
  • You want to route support tickets, messages, or requests to the most appropriate handler
  • You are building a multi-intent chatbot where each intent leads to a different agent
  • You need dynamic path selection that reasons over content, topic, language, or intent
  • You want a single LLM call to replace a chain of condition blocks
  • You need to direct execution to a named block based on free-form instructions

Configuration

Prompt

A required long-text field (prompt) where you write the routing instructions for the AI. Describe what criteria the model should use to pick the destination block.

  • Type: long-input
  • Required: yes
  • Placeholder: Route to the correct block based on the input...

Use {{blockName.field}} references to inject upstream block outputs into the prompt. For example: {{starter.input}}.

Model

A required dropdown (model) that selects which AI model evaluates the routing prompt.

  • Type: dropdown
  • Required: yes
  • Options: dynamically populated from all registered base model providers plus any locally running Ollama models. Examples include gpt-5.6-terra, gpt-5.4-mini, claude-sonnet-5, gemini-3.5-flash, deepseek-v4-flash, grok-4.3, and any Ollama model the user has pulled.

API Key

A required password field (apiKey) for the selected provider's API key.

  • Type: short-input (password)
  • Required: yes (on self-hosted; hidden automatically for hosted models when running in the hosted environment)
  • Condition: hidden for hosted models when the platform is running in hosted mode; shown for all models in self-hosted deployments

Use the {{ENV_VAR}} syntax to reference a workspace secret instead of pasting a raw key — for example: {{OPENAI_API_KEY}}.

System Prompt (hidden)

An internal code field (systemPrompt) that is auto-generated from the prompt value. It injects the routing instructions and the list of available downstream blocks into a structured system prompt that the model receives. This field is hidden from the UI and should not be set manually.

Inputs & Outputs

Inputs:

  • prompt (string) — Routing prompt content; the instructions the AI uses to select a destination block
  • model (string) — AI model identifier to use for routing
  • apiKey (string) — Provider API key for authenticating the LLM request

Outputs:

  • content (string) — Raw text response returned by the routing model (the selected block ID)
  • model (string) — The model that was actually used to process the request
  • tokens (json) — Token usage breakdown: { prompt, completion, total }
  • cost (json) — Cost breakdown in USD: { input, output, total }
  • selectedPath (json) — The resolved routing destination: { blockId, blockType, blockTitle }

Tools

The Router block executes through dedicated LLM provider handlers, not the generic tool registry. The provider used at runtime is determined by the selected model. The tool ids listed in tools.access map to these LLM providers:

  • OpenAI Chat (openai_chat) — Routes via an OpenAI model (e.g. gpt-5.6-terra, gpt-5.4-mini)
  • Anthropic Chat (anthropic_chat) — Routes via an Anthropic model (e.g. claude-sonnet-5)
  • Google Chat (google_chat) — Routes via a Google model (e.g. gemini-3.5-flash)
  • xAI Chat (xai_chat) — Routes via an xAI model (e.g. grok-4.3)
  • DeepSeek Chat (deepseek_chat) — Routes via DeepSeek's standard chat model
  • DeepSeek Reasoner (deepseek_reasoner) — Routes via DeepSeek's reasoning model

The executor selects the correct provider based on the model parameter at runtime via getAllModelProviders().

YAML Example

router_1:
  type: router
  name: "Router"
  inputs:
    prompt: "Route this customer message to the correct department: {{starter.input}}"
    model: "gpt-5.4-mini"
    apiKey: "{{OPENAI_API_KEY}}"
  connections:
    outgoing:
      - target: billing-agent-id
      - target: technical-agent-id
      - target: sales-agent-id