YAML Configuration

YAML for flow of control

In FloAI, YAML is used to define workflows, agents, and teams in a structured manner, allowing for flexible configurations. This page explains the key components of the YAML configuration file, detailing how each part contributes to the overall agentic flow. By breaking down each section, you'll understand how to create custom agents and teams, assign jobs, and configure tools.

Let's break down the structure of a YAML file and its key components:

Key Components of the YAML Structure

NameDescription

kind

The type of agentic Flo you're creating. This can be either FloRoutedTeam (for defining teams) or FloAgent (for defining a single agent).

name

The name of the agentic flow. This can be an alphanumeric string and serves as the identifier for the Flo.

team/agent

Depending on whether you're creating a team or a single agent, this key specifies the overall entity.

team.router

The router manages how tasks are handled within a team. It decides the flow of tasks and which agent performs what task based on the current state. Supported router types are supervisor, linear, and llm. More routers will be introduced in future releases.

(team/agent).name

The name of the team or agent. It must be a valid alphanumeric string without spaces.

agent.job

The job or task that the agent is expected to perform. This field specifies the core responsibility of the agent.

agent.role

This optional field assigns a persona or role to the agent, giving it a specific identity (e.g., "Researcher", "Support Specialist").

agent.tools

A list of tools that the agent can use to accomplish its job. These tools should be pre-defined and registered within the session.

YAML Structure Breakdown

To understand the structure better, here's a detailed explanation of each part of a sample YAML configuration:

apiVersion: flo/alpha-v1
kind: FloRoutedTeam
name: support-team
team:
    name: SupportTeam
    router:
        name: TeamSupervisor
        kind: supervisor
    agents:
      - name: HousingLoanAgent
        role: Housing Loan Specialist
        job: Fetch housing loan information from the database and answer user questions
        tools:
          - name: HousingLoanTool
      - name: CreditScoreAgent
        role: Credit Score Advisor
        job: Retrieve and explain credit scores based on user data
        tools:
          - name: CreditScoreTool

1. apiVersion

The version of the API you're using in FloAI. For most configurations, the value will be:

apiVersion: flo/alpha-v1

This ensures that the correct version of FloAI's configuration engine is used to interpret your YAML file.

Right now the only supported version is alpha-v1. If we are to bring changes in the yaml structure this version will change, but it will have backward compatibility

2. kind

The kind field specifies the type of agentic flow you're creating. There are two primary types:

  • FloRoutedTeam: Used to define a team of agents working together.

  • FloAgent: Used to define a single agent acting independently.

For example:

kind: FloRoutedTeam

3. name

The name field assigns a unique identifier to the Flo you're building. This is how the system will refer to the entire agentic flow.

Example:

name: support-team

4. team/agent

  • team: If you're creating a team of agents, you'll use this key. Under the team key, you define the agents and their roles.

  • agent: If you're defining a single agent, you'll use this key instead of team.

In the example above, we have a team configuration, so team is used. The team object contains:

  • name: The name of the team.

  • router: Defines the routing logic within the team.

Example:

team:
    name: SupportTeam

5. team.router

A router is responsible for managing the flow of tasks in a team. Routers decide how tasks are distributed among agents and ensure that the right agent is called based on the task at hand.

Currently supported routers include:

  • supervisor: Manages tasks hierarchically, distributing tasks based on a decision tree or workflow.

  • linear: Executes agents in a linear fashion, one after another, in the order they are defined.

  • llm: The router determines which agent to invoke based on a natural language prompt.

Example of configuring a supervisor router:

router:
    name: TeamSupervisor
    kind: supervisor

6. (team/agent).name

The name field under team or agent provides a unique name for the team or agent. This name is alphanumeric and must not contain spaces.

Example:

name: HousingLoanAgent

7. agent.job

The job field specifies what the agent is responsible for. This defines the core task or function the agent will perform.

Example:

job: Fetch housing loan information from the database and answer user questions

8. agent.role

The optional role field assigns a persona or character to the agent. This can be useful for defining specialized roles in a team or giving an agent specific expertise (e.g., a researcher or a financial advisor).

Example:

role: Housing Loan Specialist

9. agent.tools

The tools field lists the tools the agent will use to accomplish its job. These tools must be registered with the FloSession beforehand.

Example:

tools:
  - name: HousingLoanTool

Example: A Simple FloAgent Configuration

Here's an example of defining a single agent (FloAgent) that performs one job:

apiVersion: flo/alpha-v1
kind: FloAgent
name: single-agent
agent:
    name: InformationFetcher
    job: Retrieve data based on user queries
    role: Data Retriever
    tools:
      - name: DataFetcherTool

In this example:

  • kind: We are defining a single agent (FloAgent).

  • name: The agentic flow is named single-agent.

  • agent.name: The agent's name is InformationFetcher.

  • agent.job: The agent's task is to retrieve data based on user queries.

  • agent.tools: The agent has access to a tool called DataFetcherTool.

Advanced Configurations: Teams with Sub-Teams

FloAI supports composability, meaning you can nest sub-teams within teams, enabling complex workflows. Here's an example of a team configuration with sub-teams:

apiVersion: flo/alpha-v1
kind: FloRoutedTeam
name: blogging-team
team:
    name: BloggingTeam
    router:
        name: TeamLead
        kind: supervisor
    subteams:
        - name: ResearchTeam
          router:
              name: ResearchSupervisor
              kind: supervisor
          agents:
              - name: Researcher
                job: Perform internet research on a given topic
                tools:
                - name: InternetSearchTool
        - name: WritingTeam
          router:
              name: WritingSupervisor
              kind: supervisor
          agents:
              - name: Blogger
                job: Write a blog based on the research findings
                tools:
                - name: BlogWriterTool

In this example:

  • The BloggingTeam has two sub-teams: ResearchTeam and WritingTeam.

  • Each sub-team has its own agents and supervisor router, enabling task delegation and coordination across multiple teams.

Conclusion

The YAML configuration in FloAI allows for extensive customization of agentic flows, enabling you to create simple or complex workflows. By understanding how to use key components like agents, teams, routers, and tools, you can effectively design workflows tailored to your needs.

As FloAI evolves, more router types and advanced configurations will become available, providing even greater flexibility in building agentic systems.

Last updated