Routing

Routing determines whether a message is handled by a Pipeline or an Agent. The decision is made at the very beginning of the flow and applied after preprocessing completes.

How Routing Works — Two-Pass Design

Routing is not a single step — it happens in two passes through the same Route processor:

First pass (at the start): The system reads the chatbot configuration and decides the destination — Pipeline or Agent. This decision is stored internally as PREROUTE_NEXT_STATE_KEY but not yet applied. The flow continues normally through input processing, validation, and preprocessing.

Second pass (after preprocessing): After preprocessing finishes, the flow returns to Route. This time, the stored destination is applied and the message is directed to the correct handler.

When Does Each Path Run?

Condition
Destination

Chatbot has agent_ids configured

Agent

Standard chatbot (no agent IDs)

Pipeline

Deep research search type enabled

Pipeline (with a specialized pipeline handler)

GLChat Live

Pipeline (with the Live pipeline handler)

Pipeline vs Agent

Pipeline
Agent

Behavior

Structured, deterministic flow — retrieval then generation

Flexible, multi-step — can call tools, loop, reason

Best for

Knowledge base Q&A, document search, structured data queries

Complex tasks requiring tool use, multi-step reasoning

Response

Streamed directly from generation

Streamed after agentic process completes

Goes to postprocessing

Yes

Yes

Future: Smart Routing

The current routing model is configuration-driven — the destination (Pipeline or Agent, and which specific pipeline) is determined entirely by the chatbot's static configuration at the time the request arrives.

A planned improvement is smart routing: instead of relying solely on preconfigured rules, the system would analyze the content and intent of each incoming message at runtime and automatically select the most appropriate pipeline or agent. For example:

  • A factual question about internal documents → Standard RAG

  • A complex research query → Deep Research

  • A task requiring tool use or multi-step reasoning → Agent

  • A general conversation with no knowledge base → No-Op

This would allow a single chatbot configuration to adapt its execution path dynamically based on what the user is actually asking, rather than routing every message through the same fixed pipeline.

circle-info

Smart Routing is not implemented yet and we will update this documentation once it's implemented

Last updated