Skip to content

Autonomous multi-agent system built using LangChain and LangGraph that orchestrates collaborative agents—Supervisor, Researcher, Writer, and Critiquer—to automatically gather information, generate detailed research reports, refine output, and visualise the workflow as a graph. Includes a Streamlit web UI and optional Graphviz visualisation.

Notifications You must be signed in to change notification settings

AnnasMustafaDev/Multi-Agent-Research-Assistant-Langgraph

Repository files navigation

Multi-Agent Research Assistant

A collaborative Agent-to-Agent (A2A) system built using LangChain and LangGraph, designed to generate detailed and well-structured research reports through intelligent agent cooperation.

LangGraph Architecture
System architecture built with LangGraph illustrating multi-agent collaboration.

Project Structure

multi_agent_researcher/
├── assets/
│   └── (graph visualizations saved here)
├── .env
├── requirements.txt
├── prompts.py
├── agents.py
├── graph.py
├── visualize_graph.py
├── app.py
└── README.md

Installation

Prerequisites

  • Python 3.9 or higher
  • pip package manager
  • (Optional) Graphviz for graph visualization

Step 1: Clone or Create Project Directory

mkdir multi_agent_researcher
cd multi_agent_researcher

Step 2: Install Python Dependencies

pip install -r requirements.txt

Step 3: Configure Environment Variables

Create a .env file in the root directory:

# Get API key from https://www.together.ai/
TOGETHER_API_KEY=your_together_api_key_here

# Get API key from https://tavily.com/
TAVILY_API_KEY=your_tavily_api_key_here

Getting API Keys:

  1. Together AI: Sign up at together.ai and create an API key
  2. Tavily: Sign up at tavily.com and get your API key

Step 4: (Optional) Install Graphviz for Visualization

Ubuntu/Debian:

sudo apt-get install graphviz graphviz-dev

macOS:

brew install graphviz

Windows:

choco install graphviz

🎯 Usage

Generate Workflow Visualization (Optional)

python visualize_graph.py

This creates a visual diagram of the agent workflow in assets/research_graph.png

Run the Streamlit Application

streamlit run app.py

The app will open in your browser at http://localhost:8501

🤖 How It Works

The system uses four specialized AI agents that work together:

  1. ** Supervisor Agent**

    • Coordinates the entire workflow
    • Decides which agent should work next
    • Manages task delegation
  2. ** Researcher Agent**

    • Searches the web for relevant information
    • Uses Tavily search API
    • Gathers and compiles research findings
  3. ** Writer Agent**

    • Creates research reports from findings
    • Revises drafts based on feedback
    • Ensures coherent and well-structured output
  4. ** Critiquer Agent**

    • Reviews drafts for quality
    • Provides actionable feedback
    • Approves final reports

Workflow

Start → Supervisor → Researcher → Supervisor → Writer → Critiquer → Supervisor
                ↑                                                        ↓
                └────────────────── (loop until approved) ──────────────┘

Troubleshooting

Common Issues

1. Import Errors

# Reinstall all dependencies
pip install -r requirements.txt --upgrade

2. API Key Errors

  • Verify your .env file is in the project root
  • Check that API keys are correct and active
  • Ensure no extra spaces in the .env file

3. Together AI Connection Issues

  • The code uses Together AI's OpenAI-compatible endpoint
  • Ensure your API key has sufficient credits
  • Check network connectivity

4. Graphviz Installation Issues

  • Graphviz is optional for visualization
  • The app will work without it
  • If needed, follow

About

Autonomous multi-agent system built using LangChain and LangGraph that orchestrates collaborative agents—Supervisor, Researcher, Writer, and Critiquer—to automatically gather information, generate detailed research reports, refine output, and visualise the workflow as a graph. Includes a Streamlit web UI and optional Graphviz visualisation.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages