Skip to content

Flow Super Agent

The FlowSuperAgent in the AI Refinery SDK is designed to orchestrate complex workflows composed of multiple utility agents with defined dependencies. The FlowSuperAgent allows users to define nodes (utility agents) and edges (dependencies) between them, enabling the creation of flexible and powerful pipelines.

Workflow Overview

The FlowSuperAgent is invoked by the orchestrator for complex tasks that are defined by the user as directed graphs. Upon invocation, the FlowSuperAgent workflow is structured around three essential components:

  1. Goal: The overall goal that the FlowSuperAgent needs to accomplish by following the deterministic workflow defining the action steps.

  2. Agent List: A FlowSuperAgent has access to a pool of utility agents (e.g., SearchAgent, AuthorAgent, etc.) that it directs to accomplish the overall goal.

  3. Workflow Graph Definition: The graph dictating the workflow of the FlowSuperAgent that defines the dependencies between the utility agents to schedule the task execution.

Usage

Flow super agents can be easily integrated into your project by adding the necessary configurations to your project YAML file. Specifically, you need to:

  • List your super agents under the super_agents attribute in your project's YAML configuration.
  • Ensure the agent_name you chose for your super_agents are listed in the agent_list under orchestrator.
  • Ensure that the assistant agents that are available to the FlowSuperAgent are listed as agents in the utility_agents list.
  • Define the deterministic workflow as a graph with vertices and edges. To do so:
    • Define the vertices as entries in the agent_list of the FlowSuperAgent
    • Define the edges by specifying for each agent_name in the agent_list the next_step that will be taken.

Quickstart

To quickly set up a project with a FlowSuperAgent, use the following YAML configuration. In this setup, we have a single flow super agent that acts as Strategy Advisor. It has three instances of a SearchAgent and one of the AuthorAgent in its agent pool. You can add more super agents and utility agents as needed.

utility_agents:
  - agent_class: AuthorAgent # AuthorAgent class design
    agent_name: "Brief Writer" # Required. A name that you choose for your AuthorAgent.
    agent_description: "Write the marketing brief" # Required. Description of your AuthorAgent.
    config: # Required. Configuration of this AuthorAgent.
      memory_attribute_key: "plan" # Memory key to store the generated summary.
      title: "Insights Brief" # Title for the draft summary.
      leading_questions: # Guiding questions used by the AuthorAgent to structure the brief.
        - question: "What is the name of the project?" # Required. First guiding question.
          prompt: "Project name. This is usually specified by the background information." # Prompt to guide answering the question.
        - question: "Who is the audience?" # Required. Second guiding question.
          prompt: "Who exactly are we targeting? Detail the specific demographics, industries, or roles we aim to reach, emphasizing how our project aligns with their interests and needs." # Prompt to guide answering the question.
        - question: "What do they want to do and why?" # Required. Third guiding question.
          prompt: "What are the audience's main objectives and motivations? Let's dive into their goals to understand how our project aligns with their needs, rather than focusing on our growth targets." # Prompt to guide answering the question.
        - question: "How can we help them?" # Required. Fourth guiding question.
          prompt: "What specific support or solutions can we offer to meet the audience's needs? Propose a range of options for discussion." # Prompt to guide answering the question.

  - agent_class: SearchAgent # SearchAgent class design
    agent_name: "Competitor Researcher" # Required. A name that you choose for this SearchAgent.
    agent_description: "Find what our competitors have done in the area / industry." # Required. Description of this SearchAgent's research scope.

  - agent_class: SearchAgent # SearchAgent class design
    agent_name: "Campaign Insights Researcher" # Required. A name that you choose for this SearchAgent.
    agent_description: "Find insights and takeaways from other past campaigns that are relevant to this topic." # Required. Description of this SearchAgent's research scope.

  - agent_class: SearchAgent # SearchAgent class design
    agent_name: "Audience Understanding Researcher" # Required. A name that you choose for this SearchAgent.
    agent_description: "Identify the potential audience for this campaign focusing on their desires, concerns, and needs." # Required. Description of this SearchAgent's research scope.

super_agents:
  - agent_class: FlowSuperAgent # FlowSuperAgent class design
    agent_name: "Strategy Advisor" # Required. A name that you choose for your super agent.
    agent_description: | # Required. Description of your super agent.
      The Strategy Advisor can help user write their marketing campaign brief. Only call this agent when the user explicitly asks for a brief.

    config: # Required. Configuration of this super agent.
      goal: | # Required. A high level goal of your super agent.
        The goal is to create an insights brief for a marketing campaign at Accenture. To create the brief, you will need to call the research agent to do research around the topic. Make sure you have called all the agents (you can track the call history from below) before you call the author agent to draft an insights brief.

      agent_list: # Required. The list of agents to be added in the agent pool. Each agent listed here must be configured under `utility_agents` in the root of the project YAML file.
        - agent_name: "Competitor Researcher"  # Required.
          next_step: # User design. These are the tasks that depend on this step and will be executed afterward.
            - "Campaign Insights Researcher"
            - "Audience Understanding Researcher"

        - agent_name: "Campaign Insights Researcher"  # Required.
          next_step: # User design. Specifies next steps to run after this agent.
            - "Brief Writer"

        - agent_name: "Audience Understanding Researcher"  # Required.
          next_step: # User design. Specifies next steps to run after this agent.
            - "Brief Writer"

        - agent_name: "Brief Writer"  # Required. Exit agent that produces the summary output.

Template YAML Configuration of FlowSuperAgent

In addition to the configurations mentioned for the example above, the FlowSuperAgent supports several other configurable options. See the template YAML configuration below for all available settings for each super agent.

agent_class: FlowSuperAgent # The class must be FlowSuperAgent
agent_name: <A name that you choose for your super agent.> # Required. 
agent_description: <Description of your super agent.> # Required.

config: # Required. Configuration of this super agent.
  goal: <A high level goal of your super agent.> # Required

  agent_list: # Required. The list of agents to be added in the agent pool. Each agent listed here must be configured under `utility_agents` in the root of project YAML file.
    - agent_name: <Name of agent 1>  # Required. 
      next_step: # Optional. If provided, these will be the tasks that depend on the execution of the current one and will be run after this step is completed (next nodes in the workflow graph). If not provided, this step does not set any dependedny for the next ones (node in workflow graph does not have other nodes it connects to) 
        - <Name of Agent 2>
        - <Name of Agent 3>

    - agent_name: <Name of agent 2>  # Required.
        next_step:  <Name of agent 3>

  agent_concurrency: 3 # Optional. Number of maximum parallel thread workers for execution. Defaults to 5.

  magic_prompt: "" # Optional. Template for generating prompts for nodes. Defaults to a predefined prompt. 

  llm_config:
  # Optional. Customized llm config (if you want the Flow SuperAgent to use a different LLM than the on in your base config)
    model: <model_name>