Skip to content

Latest commit

 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LangChain Multi-Agent Research System

A powerful multi-agent research system built with LangChain that autonomously researches topics, gathers information, writes comprehensive reports, and evaluates their quality using AI-powered agents.

🔬 Research Automation • 🤖 Multi-Agent Orchestration • 📝 Intelligent Report Generation


🌟 Features

  • Multi-Agent Architecture: Specialized agents for searching, reading, writing, and critiquing
  • Automated Web Research: Intelligent web search with Tavily API
  • Smart Content Extraction: Advanced web scraping with multiple fallback strategies
  • AI-Powered Report Generation: Automatically generates structured research reports
  • Quality Evaluation: Built-in critic agent for report validation and scoring
  • Interactive UI: Streamlit-based user interface for easy interaction
  • Pipeline Orchestration: Seamless coordination of multiple agents

🏗️ Architecture

┌─────────────────────────────────────────────────────┐
│           Streamlit UI (app.py)                     │
│      Multi-Agent Research Assistant Interface       │
└──────────────────┬──────────────────────────────────┘
                   │
┌──────────────────▼──────────────────────────────────┐
│      Research Pipeline (pipeline.py)                │
│        Orchestrates multi-agent workflow            │
└──────────────────┬──────────────────────────────────┘
                   │
    ┌──────────────┼──────────────┐
    │              │              │
┌───▼───┐    ┌────▼─────┐   ┌───▼────┐
│Search │    │   Reader  │   │ Writer │
│Agent  │    │   Agent   │   │ Chain  │
└───┬───┘    └────┬─────┘   └───┬────┘
    │             │             │
    │  ┌──────────▼─────────┐   │
    └─▶│  Tools Layer       │◀──┘
       │                    │
       │ • web_search      │
       │ • scrape_url      │
       │                    │
       └────────┬───────────┘
                │
            ┌───▼────────┐
            │ Critic     │
            │ Chain      │
            └────────────┘

Agent Responsibilities

  • Search Agent: Discovers relevant information across the web using Tavily
  • Reader Agent: Extracts clean, readable content from URLs
  • Writer Chain: Composes structured, professional research reports
  • Critic Chain: Evaluates reports and provides improvement suggestions

🛠️ Technologies Used

Technology Purpose
LangChain Multi-agent orchestration and chain management
Groq (Qwen 3 32B) Language model for agents and chains
Streamlit Interactive web UI
Tavily API Web search and information retrieval
BeautifulSoup4 HTML parsing and content extraction
Trafilatura Web content extraction
Readability-lxml Article content extraction
Python-dotenv Environment configuration management
Rich Terminal output formatting

📋 Prerequisites

  • Python 3.11 or higher
  • GROQ API Key
  • Tavily API Key

🚀 Installation

1. Clone the Repository

git clone https://github.com/AmanXk/multiagent-research-agent.git
cd multiagent-research-agent

2. Create Environment (conda)

conda create -n langagent python=3.11 -y
conda activate langagent

Or with venv:

python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

3. Install Dependencies

pip install -r requirements.txt

4. Configure Environment Variables

Create a .env file in the project root:

GROQ_API_KEY=your_groq_api_key_here
TAVILY_API_KEY=your_tavily_api_key_here

Get your keys from:


💡 Usage

Run with Streamlit UI (Recommended)

streamlit run app.py

Then open http://localhost:8501 in your browser.

Run as a Script

python main.py

Edit the topic variable in main.py to research different topics.


📁 Project Structure

.
├── app.py                      # Streamlit web interface
├── main.py                     # CLI entry point
├── requirements.txt            # Python dependencies
├── README.md                   # This file
│
└── src/
    ├── __init__.py
    ├── agents/
    │   ├── __init__.py
    │   └── agents.py           # Search, Reader, Writer, Critic agents
    ├── tools/
    │   ├── __init__.py
    │   └── tools.py            # web_search, scrape_url tools
    └── pipelines/
        ├── __init__.py
        └── pipeline.py         # Main research orchestration

🔄 Workflow

  1. User Input: Enter a research topic via UI or script
  2. Search Phase: Search agent queries the web using Tavily
  3. Reading Phase: Reader agent extracts content from relevant URLs
  4. Writing Phase: Writer chain synthesizes findings into a structured report
  5. Review Phase: Critic chain evaluates the report and provides scores
  6. Output: Display final report with feedback and scores

📊 Example Output

The system generates reports with:

  • Comprehensive introduction and background
  • Key findings with detailed explanations
  • Well-sourced conclusions
  • Structured sections and proper formatting
  • Quality scores from 1-10

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


🙏 Acknowledgments


📧 Support

For support, open an issue on GitHub

Happy Researching!

About

Multi-agent research pipeline that transforms a topic into a structured report through search, web scraping, writing, and critique stages.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages