Skip to content

Latest commit

 

History

History
151 lines (106 loc) · 4.38 KB

File metadata and controls

151 lines (106 loc) · 4.38 KB

Multi-Agent Supervisor System

A modular multi-agent system built with LangGraph and Groq that coordinates between Researcher, Analyst, and Writer agents to process complex tasks.

🚀 Features

  • Modular Architecture: Clean separation of concerns with dedicated modules for agents, core logic, and UI
  • Multi-Agent Coordination: Supervisor agent orchestrates workflow between specialized agents
  • Interactive Web UI: Beautiful Streamlit interface for easy interaction
  • Real-time Processing: Live updates during task execution
  • Task History: Track and review previous analyses
  • Downloadable Reports: Export generated reports in text format

🏗️ Architecture

supervisor_agent_app/
├── agents/                 # Agent implementations
│   ├── __init__.py
│   ├── supervisor.py      # Coordinates workflow
│   ├── researcher.py      # Gathers information
│   ├── analyst.py         # Analyzes data
│   └── writer.py          # Creates reports
├── core/                  # Core system logic
│   ├── __init__.py
│   ├── state.py          # State definitions
│   ├── workflow.py       # Graph workflow
│   ├── router.py         # Agent routing
│   └── llm_config.py     # LLM configuration
├── ui/                   # User interface
│   └── streamlit_app.py  # Streamlit web app
├── main.py              # CLI application
├── requirements.txt     # Dependencies
└── .env.example        # Environment template

🛠️ Setup

1. Install Dependencies

pip install -r requirements.txt

2. Environment Configuration

  1. Copy .env.example to .env:

    cp .env.example .env
  2. Add your Groq API key to .env:

    GROQ_API_KEY=your_actual_groq_api_key_here
    
  3. Get a Groq API key from: https://console.groq.com/keys

🎯 Usage

Web Interface (Recommended)

Run the Streamlit app:

streamlit run ui/streamlit_app.py

Then open your browser to http://localhost:8501

Command Line Interface

Run the CLI version:

python main.py

🤖 How It Works

  1. Supervisor Agent: Receives the task and decides which agent should work next
  2. Researcher Agent: Gathers comprehensive information about the topic
  3. Analyst Agent: Analyzes the research data and provides insights
  4. Writer Agent: Creates a professional report with findings and recommendations

The workflow continues until all agents have completed their tasks and a final report is generated.

📝 Example Tasks

  • "What are the benefits and risks of AI in healthcare?"
  • "Analyze the current state of renewable energy adoption"
  • "Research the impact of remote work on productivity"
  • "Investigate the latest trends in cybersecurity"

🔧 Configuration

Model Configuration

The system uses Groq's llama-3.3-70b-versatile model by default. You can modify this in core/llm_config.py.

Adding New Agents

  1. Create a new agent file in the agents/ directory
  2. Implement the agent function following the existing pattern
  3. Add the agent to the workflow in core/workflow.py
  4. Update the router in core/router.py

🚦 System Requirements

  • Python 3.8+
  • Groq API key
  • Internet connection for LLM API calls

🐛 Troubleshooting

Common Issues

  1. Missing API Key: Ensure your .env file contains a valid GROQ_API_KEY
  2. Import Errors: Make sure all dependencies are installed with pip install -r requirements.txt
  3. Port Issues: If Streamlit port 8501 is busy, use: streamlit run ui/streamlit_app.py --server.port 8502

Debugging

  • Check the console output for detailed error messages
  • Ensure your Groq API key has sufficient credits
  • Verify internet connectivity for API calls

📊 Performance

  • Average task completion time: 30-60 seconds
  • Supports concurrent requests in Streamlit
  • Optimized for tasks requiring research and analysis

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

📄 License

This project is open source and available under the MIT License.

🆘 Support

For issues and questions:

  1. Check the troubleshooting section above
  2. Review the console output for error details
  3. Ensure all requirements are properly installed