Spaces:
Runtime error
Runtime error
metadata
title: multi-agent
app_file: company_info_search.py
sdk: gradio
sdk_version: 5.1.0
Multi-Agent Swarm
This example demonstrates a multi-agent swarm with three agents: an Enhancer, an Executor, and a Checker. The agents work together to process user queries and provide well-thought-out, verified responses.
Setup
To run this example:
- Ensure you have installed the Swarm framework as described in the main README.
- Set up your
.env
file in the root directory with the necessary API key:OPENAI_API_KEY=your_openai_api_key_here
- Navigate to this directory:
cd examples/multi_agent_swarm
- Run the example:
python multi_agent_swarm.py
Agents
- Enhancer Agent: Enhances user prompts by adding instructions for reasoning steps and chain of thought.
- Executor Agent: Executes the enhanced prompts and provides detailed, well-thought-out responses.
- Checker Agent: Checks responses for correctness, approves correct ones, and edits/improves incorrect ones.
Process Flow
- User input is received by the Enhancer Agent.
- Enhancer Agent enhances the prompt and transfers to the Executor Agent.
- Executor Agent processes the enhanced prompt and transfers the response to the Checker Agent.
- Checker Agent verifies the response. If correct, it's shown to the user. If not, it's edited and the process restarts from the Enhancer Agent.
This example uses the run_demo_loop
helper function to create an interactive Swarm session.