Routers

Routers that connect agents and teams

Routers are the cornerstone of how workflows are executed in FloAI. They determine how agents are connected and how the flow of execution is managed. By configuring routers, you can define how different agents interact and how tasks are delegated. The behavior of a router can be specified in the YAML configuration by setting the kind in the router component.

Configuring a Router

To configure a router in FloAI, you can modify the YAML configuration by specifying the type of router you want to use. Each router type has its functionality and governs the flow of execution in a unique way.

Here’s an example of how you can configure a router in your YAML file:

router:
  kind: supervisor  # or 'linear', 'llm' depending on the routing logic

By adjusting the kind, you control the type of router that governs how agents are executed in your workflow.

Supported Router Types

FloAI currently supports the following router types:

RouterFunctionality

supervisor

In this type of router, all the agents are connected in a hierarchical fashion. The supervisor router decides which agent to call based on the context, managing the flow between different agents. It acts as the main orchestrator.

linear

In a linear router, the agents are executed in sequence, one after another, based on their order in the workflow. This router supports more advanced functionalities such as delegators and reflection agents, allowing for dynamic re-routing and reflective decision-making within the flow.

llm

The LLM-based router uses a language model to route tasks dynamically based on the provided prompt. This enables flexible, prompt-driven execution paths where the agents to be called are determined by the context and the output of an LLM.

Router Types Explained

Supervisor Router

The supervisor router organizes agents in a hierarchical structure. It’s designed to act as a supervisor, deciding which agent to invoke at each step based on the context. This type of routing is ideal for cases where there’s a clear decision-making authority that controls agent interactions.

Linear Router

The linear router follows a sequential approach, where agents are executed one after another in a predefined order.

This type of routing is suitable for workflows that need strict, step-by-step execution but still require flexibility in re-routing when needed.

Right now delegator agents and reflection agents are only supported by linear routers:

  • Delegators: Agents that can delegate tasks to other agents based on specific conditions.

  • Reflection Agents: Special agents that can re-route the flow based on the outcome of previous tasks or new conditions that arise during execution.

LLM Router

The llm router leverages the power of large language models to dynamically decide the routing based on the prompt provided. This type of router is best used in scenarios where decisions need to be made on the fly, and the flow of execution depends heavily on contextual understanding.

Last updated