Creating Complex Workflows with Flowise

Aug 14, 2024

Lecture Notes: Building Complex Agent Workflows with Flowise

Introduction

  • Flowise provides two powerful solutions:
    • Multi-agents
    • Sequential agents
  • Aim: Compare these features by creating the same project using both methods.

Multi-Agent Example

  • Supervisor Node: Manages task delegation among worker nodes (e.g., Software Developer, Code Reviewer).
  • Workflow:
    • The supervisor is delegated to manage tasks.
    • Add a Chat OpenAI LLM to the supervisor.
    • Use settings: GPT40 model, Temperature: 0.4.
    • Connect Chat OpenAI node to supervisor node.
    • Supervisor's task: Decides which team member acts next or terminates the process.

Setting Up Multi-Agent Team

  • Nodes:
    • Supervisor node is set up with an LLM.
    • Worker nodes added: Software Developer and Code Reviewer.
  • Prompts:
    • Software Developer: Build app based on user requirements using technologies like React, JavaScript, Tailwind CSS.
    • Code Reviewer: Ensure code quality and provide feedback.
  • Execution:
    • Tasks are assigned, executed, and feedback is shared between nodes.
    • Supervisor manages back-and-forth communication until task completion.

Limitations of Multi-Agents

  • Limited control over application behavior.
  • Reliance on supervisor for decision-making.

Sequential Agent Example

  • Objective: Replicate the multi-agent application using sequential agents.
  • Setup:
    • Start with a new flow: Sequential Agent Software Team.
    • Add a starting node and connect it with a Chat OpenAI node.
    • Model: GPT40 with Temperature: 0.2.
    • Add a state node to keep track of application state.

Building Sequential Agent Workflow

  • Supervisor Node:
    • Uses LLM to determine the next node and set a state variable.
    • System prompt instructs supervisor on managing worker conversations.
  • Node Logic:
    • Set system and human prompts to guide conversation flow.
    • Extract task decision using JSON structured output.

Condition and Execution

  • Condition Node:
    • Determines next action based on LLM output stored in state.
    • Conditions set for Software Developer and Code Reviewer.
  • Workers Setup:
    • Nodes for Software Developer and Code Reviewer.
    • Each node completes a task and loops back to the supervisor.

Completing the Workflow

  • Loop and End State:
    • Set up loops for continuous back and forth between nodes.
    • Use end state to summarize and conclude the process.

Conclusion

  • Example shows how to effectively use sequential agents for complex workflows.
  • Additional resources recommended for learning more about sequential agents.