Skip to content

About

Multi-agent AI research system combining RAG, LangChain, Tavily, web scraping, LCEL, and Streamlit for automated research and report generation

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”ฌ Multi-Agent Research System

A multi-agent AI research system built with LangChain that automates the research process from web search to report generation and quality evaluation.

The system uses specialized agents and chains to search for information, extract relevant content from web pages, generate a structured research report, and evaluate the final output.

๐ŸŒŸ Features

  • ๐Ÿ”Ž Search Agent โ€” Searches the web using the Tavily API to find relevant sources.
  • ๐Ÿ“– Reader Agent โ€” Fetches and parses web pages using Requests and BeautifulSoup4 to extract useful content.
  • โœ๏ธ Writer Chain โ€” Synthesizes the collected research into a structured Markdown report.
  • ๐Ÿง Critic Chain โ€” Reviews the generated report, evaluates its quality, identifies strengths, and suggests improvements.
  • ๐Ÿ”— Multi-Agent Pipeline โ€” Connects all stages into a complete research workflow.
  • ๐Ÿง  Shared State โ€” A central Python dictionary passes research results between different stages of the pipeline.
  • ๐Ÿ–ฅ๏ธ Streamlit Interface โ€” Provides an interactive web interface for submitting research topics and viewing results.
  • ๐Ÿงฉ Modular Architecture โ€” Agents, tools, chains, and pipeline logic are separated for easier extension.

๐Ÿ—๏ธ Architecture

                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚       Streamlit UI       โ”‚
                         โ”‚          app.py          โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                      โ”‚
                                      โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚     Research Pipeline    โ”‚
                         โ”‚       pipeline.py        โ”‚
                         โ”‚                          โ”‚
                         โ”‚    Shared State (dict)   โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                      โ”‚
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚                         โ”‚
                         โ–ผ                         โ–ผ
                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                โ”‚   Search Agent  โ”‚       โ”‚   Reader Agent  โ”‚
                โ”‚                 โ”‚       โ”‚                 โ”‚
                โ”‚    Tavily API   โ”‚       โ”‚ Requests + BS4  โ”‚
                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ”‚                         โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                      โ”‚
                                      โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚      Writer Chain        โ”‚
                         โ”‚                          โ”‚
                         โ”‚ ChatPromptTemplate       โ”‚
                         โ”‚        + LLM             โ”‚
                         โ”‚        + LCEL             โ”‚
                         โ”‚   + StrOutputParser      โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                      โ”‚
                                      โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚      Critic Chain        โ”‚
                         โ”‚                          โ”‚
                         โ”‚ Reviews generated report โ”‚
                         โ”‚ Scores & suggests fixes  โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                      โ”‚
                                      โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚    Final Research Report โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”„ Research Workflow

The system follows a multi-stage research pipeline:

Research Topic
      โ”‚
      โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Search Agent  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
        โ”‚
        โ”‚ Search results & URLs
        โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Reader Agent  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
        โ”‚
        โ”‚ Extracted web content
        โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Writer Chain  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
        โ”‚
        โ”‚ Draft report
        โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Critic Chain  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
        โ”‚
        โ”‚ Evaluation & feedback
        โ–ผ
 Final Research Report

๐Ÿค– Agents & Components

๐Ÿ”Ž Search Agent

The Search Agent uses Tavily to search the web for information related to the user's research topic.

It retrieves relevant search results, URLs, and snippets that are passed to the next stage of the pipeline.

๐Ÿ“– Reader Agent

The Reader Agent uses Requests and BeautifulSoup4 to retrieve and process web pages.

The scraping process removes unnecessary HTML elements such as:

  • <script>
  • <style>
  • <nav>
  • <footer>

The remaining content is converted into readable text that can be used by the Writer Chain.

โœ๏ธ Writer Chain

The Writer Chain uses LangChain Expression Language (LCEL) to connect:

ChatPromptTemplate
       โ”‚
       โ–ผ
      LLM
       โ”‚
       โ–ผ
StrOutputParser

The chain combines the collected research and generates a structured Markdown research report containing relevant findings, analysis, and citations.

๐Ÿง Critic Chain

The Critic Chain evaluates the generated report.

It analyzes aspects such as:

  • Accuracy
  • Relevance
  • Completeness
  • Structure
  • Clarity
  • Quality of research

The critic provides a score and identifies strengths and areas that could be improved.

๐Ÿง  Shared State

The research pipeline uses a Python dictionary as shared state between the different stages.

Search Agent
     โ”‚
     โ–ผ
  state
     โ”‚
     โ”œโ”€โ”€ Search Results
     โ”‚
     โ”œโ”€โ”€ Extracted Content
     โ”‚
     โ”œโ”€โ”€ Generated Report
     โ”‚
     โ””โ”€โ”€ Critic Feedback

This allows each stage of the pipeline to access the information generated by previous stages.

๐Ÿ› ๏ธ Tech Stack

Core Framework

  • Python
  • LangChain
  • LangChain Agents
  • LCEL
  • ChatPromptTemplate
  • StrOutputParser

AI / LLM

  • OpenAI API
  • ChatOpenAI
  • GPT-4o-mini

The LLM layer can also be adapted to other supported models/providers such as Google Gemini, Mistral, or Groq.

Search & Web Processing

  • Tavily
  • Requests
  • BeautifulSoup4

Frontend

  • Streamlit

The Streamlit application provides the user interface for submitting research topics, displaying the progress of the research pipeline, viewing the generated report, and downloading the output.

Environment & Utilities

  • python-dotenv โ€” Loads API keys from .env
  • uv โ€” Python environment and package management
  • rich โ€” Formatted terminal output
  • VS Code โ€” Development environment

๐Ÿ“‹ Prerequisites

Before running the project, make sure you have:

  • Python 3.10+
  • OpenAI API key
  • Tavily API key
  • Internet connection
  • uv or pip

๐Ÿš€ Quick Start

1. Download the Repository

Download the repository and extract it.

Then open the project directory:

cd Multi-agent-research-system

2. Create a Virtual Environment

Using uv:

uv venv

Activate the environment:

macOS / Linux

source .venv/bin/activate

Windows

.venv\Scripts\activate

3. Install Dependencies

Using uv:

uv pip install -r requirements.txt

Or using pip:

pip install -r requirements.txt

4. Configure API Keys

Create a .env file in the project root:

OPENAI_API_KEY="your_openai_api_key"
TAVILY_API_KEY="your_tavily_api_key"

โš ๏ธ Never commit your .env file or expose your API keys publicly.

5. Run the Application

Start the Streamlit application:

streamlit run app.py

The application will open in your browser.

๐Ÿ’ฌ Example

Enter a research topic such as:

What are the latest developments in generative AI?

The system then:

1. Searches for relevant sources
        โ†“
2. Reads and extracts webpage content
        โ†“
3. Generates a structured research report
        โ†“
4. Critically evaluates the report
        โ†“
5. Displays the final result

๐Ÿ“ Project Structure

Multi-agent-research-system/
โ”‚
โ”œโ”€โ”€ agents.py              # Agent and chain definitions
โ”‚
โ”œโ”€โ”€ app.py                 # Streamlit application
โ”‚
โ”œโ”€โ”€ pipeline.py            # Research pipeline and shared state
โ”‚
โ”œโ”€โ”€ tools.py               # Search and web scraping tools
โ”‚
โ”œโ”€โ”€ requirements.txt       # Python dependencies
โ”‚
โ”œโ”€โ”€ .gitignore             # Git ignored files
โ”‚
โ””โ”€โ”€ README.md              # Project documentation

๐Ÿ”ง Key Technologies Explained

Technology Purpose
LangChain Agent and LLM orchestration
OpenAI LLM used for research generation
Tavily Live web search
BeautifulSoup4 HTML parsing and text extraction
Requests Fetching web pages
Streamlit Interactive web interface
LCEL Building runnable LangChain pipelines
python-dotenv Secure environment variable loading
uv Python environment and dependency management
rich Formatted terminal output

๐Ÿ”ฎ Future Improvements

Potential improvements for the system include:

  • Parallel research across multiple sources
  • Automatic source credibility scoring
  • Better citation management
  • Research history and persistent memory
  • Improved critic feedback loops
  • Automatic report export to PDF
  • Additional specialized research agents
  • Support for multiple LLM providers
  • Asynchronous research execution
  • Improved error handling and retry mechanisms

๐Ÿ‘จโ€๐Ÿ’ป Author

Vamsi Kanithi

A project exploring multi-agent AI systems, LLM orchestration, automated web research, and agentic workflows.

About

Multi-agent AI research system combining RAG, LangChain, Tavily, web scraping, LCEL, and Streamlit for automated research and report generation

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages