Routing¶
The Routing block is one of the key elements of a complex Structured Visual Agents, allowing you to disaptch 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 are checked in order, the first one matching determining the next block
LLM Dispatch - An LLM is called, with a prompt, to determine the next block
Expression Dispatch - A CEL expression is used to compute 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 all the tools in a given list have been called in the 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 given LLM outputs a truthy statement based on the message history and given prompt