Routing

The Routing block is one of the key elements of a complex Structured Visual Agent, allowing you to dispatch to different processing sequences depending on conditions.

The purpose of the routing block is to decide the next node in the control flow.

There are three modes of routing:

  • If-Then / Else-if Clauses - A list of clauses is checked in order. The first matching clause determines the next block.

  • LLM Dispatch - An LLM is called and its response is mapped to the next block.

  • Expression Dispatch - A CEL expression is evaluated, and the result is used as the next block.

The If-Then / Else-if Clauses type has a variety of different clause types that can be used:

  • State Has Keys - True if the state contains all keys in a given list

  • Scratchpad Has Keys - True if the scratchpad contains all keys in a given list

  • Tools Called In History - True if any tool in a given list has been called in the generated message history of the current sequence

  • Expression - True if a given CEL expression is true

  • And (combine clauses) - Combine two or more clauses with an AND expression

  • Or (combine clauses) - Combine two or more clauses with an OR expression

  • LLM based decision - True if the LLM returns yes or true based on the configured prompt and message history