Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ”ฌ ResearchMind

A Multi-Agent AI Research System Powered by LangChain

Python LangChain OpenAI Streamlit Tavily

Four specialized AI agents collaborate in a pipeline โ€” searching, scraping, writing, and critiquing โ€” to deliver polished research reports on any topic in minutes.


๐Ÿ“‹ Table of Contents


๐Ÿง  Overview

ResearchMind is a multi-agent AI system that automates the research report generation process. Instead of relying on a single monolithic LLM call, the system decomposes the research task into four distinct stages, each handled by a specialized agent or chain. This separation-of-concerns approach produces higher-quality outputs, mirrors a real research workflow, and demonstrates core concepts in agentic AI design.

Key Highlights

  • ๐Ÿ”— Multi-Agent Orchestration โ€” Four agents collaborate in a sequential pipeline, each with a clear responsibility.
  • ๐Ÿ› ๏ธ Tool-Augmented Agents โ€” Search and Reader agents are equipped with external tools (web search, URL scraping) for real-time data gathering.
  • โœ๏ธ Prompt-Engineered Chains โ€” Writer and Critic use carefully crafted prompt templates for structured, professional output.
  • ๐ŸŽจ Premium UI โ€” A custom-styled Streamlit interface with real-time pipeline progress tracking, dark theme, and downloadable reports.

๐Ÿ— Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                      User Input (Topic)                     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚
                           โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  AGENT 1 โ€” Search Agent                                      โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                            โ”‚
โ”‚  โ”‚  Tavily API  โ”‚  Searches the web for 5 relevant results   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  Returns titles, URLs, and snippets        โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚
                           โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  AGENT 2 โ€” Reader Agent                                      โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                        โ”‚
โ”‚  โ”‚  BeautifulSoup4  โ”‚  Scrapes the most relevant URL         โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  Extracts clean text content (3000ch)  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚
                           โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  CHAIN 3 โ€” Writer Chain                                      โ”‚
โ”‚  Prompt Template โ†’ GPT-4o-mini โ†’ StrOutputParser             โ”‚
โ”‚  Produces a structured report: Intro, Findings, Conclusion   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚
                           โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  CHAIN 4 โ€” Critic Chain                                      โ”‚
โ”‚  Prompt Template โ†’ GPT-4o-mini โ†’ StrOutputParser             โ”‚
โ”‚  Scores the report (X/10), lists strengths and improvements  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                           โ”‚
                           โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              ๐Ÿ“ Final Report + ๐Ÿง Critic Feedback            โ”‚
โ”‚              (Displayed in UI & downloadable as .md)         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿค– Agent Pipeline

Stage Component Type Tool / Technique Purpose
01 Search Agent LangChain Agent Tavily Web Search API Queries the web and retrieves the top 5 relevant results with titles, URLs, and snippets
02 Reader Agent LangChain Agent BeautifulSoup4 URL Scraper Selects the best URL from search results and scrapes clean, readable text content
03 Writer Chain LangChain LCEL Chain Prompt โ†’ LLM โ†’ Parser Synthesizes search results + scraped content into a structured research report
04 Critic Chain LangChain LCEL Chain Prompt โ†’ LLM โ†’ Parser Reviews the report and provides a score (X/10), strengths, weaknesses, and a verdict

๐Ÿ›  Tech Stack

Category Technology Purpose
LLM Framework LangChain Agent creation, prompt templates, LCEL chains, tool integration
Language Model OpenAI GPT-4o-mini Core reasoning engine for all agents and chains
Web Search Tavily API Real-time web search optimized for AI agents
Web Scraping BeautifulSoup4 + Requests HTML parsing and clean text extraction from URLs
Frontend Streamlit Interactive web UI with custom CSS theming
Environment python-dotenv Secure API key management via .env file
Language Python 3.10+ Core programming language

๐Ÿ“ Project Structure

Multi-agent-research-system/
โ”‚
โ”œโ”€โ”€ app.py              # Streamlit web UI โ€” custom-styled frontend with
โ”‚                       #   real-time pipeline progress, result display,
โ”‚                       #   and .md report download
โ”‚
โ”œโ”€โ”€ agents.py           # Agent & chain definitions
โ”‚                       #   - build_search_agent() โ†’ LangChain agent w/ Tavily tool
โ”‚                       #   - build_reader_agent() โ†’ LangChain agent w/ scraper tool
โ”‚                       #   - writer_chain โ†’ LCEL prompt | LLM | parser
โ”‚                       #   - critic_chain โ†’ LCEL prompt | LLM | parser
โ”‚
โ”œโ”€โ”€ tools.py            # Custom LangChain tools
โ”‚                       #   - web_search() โ†’ Tavily API wrapper
โ”‚                       #   - scrape_url() โ†’ BeautifulSoup4 URL scraper
โ”‚
โ”œโ”€โ”€ pipeline.py         # CLI pipeline runner โ€” runs all 4 stages sequentially
โ”‚                       #   and prints results to the terminal
โ”‚
โ”œโ”€โ”€ requirements.txt    # Python dependencies
โ”œโ”€โ”€ .env                # API keys (OPENAI_API_KEY, TAVILY_API_KEY)
โ””โ”€โ”€ .gitignore          # Excludes .env from version control

๐Ÿš€ Getting Started

Prerequisites

Installation

# 1. Clone the repository
git clone https://github.com/yourusername/Multi-agent-research-system.git
cd Multi-agent-research-system

# 2. Create and activate a virtual environment
python -m venv venv
source venv/bin/activate        # macOS / Linux
venv\Scripts\activate           # Windows

# 3. Install dependencies
pip install -r requirements.txt

# 4. Set up environment variables
#    Create a .env file in the project root:
echo "OPENAI_API_KEY=your_openai_api_key_here" > .env
echo "TAVILY_API_KEY=your_tavily_api_key_here" >> .env

๐Ÿ’ก Usage

Option 1 โ€” Web UI (Streamlit)

streamlit run app.py

This launches a polished dark-themed web interface where you can:

  1. Enter any research topic
  2. Watch the 4-stage pipeline execute in real-time with status indicators
  3. View the final report rendered as formatted Markdown
  4. Read the critic's feedback and score
  5. Download the complete report as a .md file

Option 2 โ€” CLI Pipeline

python pipeline.py

This runs the same 4-agent pipeline directly in the terminal with step-by-step output logging.


๐Ÿ“ Example Output

Input Topic: "LLM agents 2025"

๐Ÿ” Search Agent

Finds the top 5 web results with titles, URLs, and content snippets from Tavily.

๐Ÿ“„ Reader Agent

Automatically selects the most relevant URL and extracts up to 3,000 characters of clean text.

โœ๏ธ Writer Chain โ€” Research Report

# Research Report: LLM Agents in 2025

## Introduction
Large Language Model (LLM) agents have emerged as one of the most
transformative developments in artificial intelligence...

## Key Findings
1. **Agentic Frameworks Are Maturing** โ€” LangChain, CrewAI, and AutoGen...
2. **Tool-Use Is Becoming Standard** โ€” Modern agents integrate search, code...
3. **Multi-Agent Systems Show Promise** โ€” Collaborative agent architectures...

## Conclusion
The trajectory of LLM agents in 2025 suggests a shift from...

## Sources
- https://example.com/llm-agents-2025
- https://example.com/ai-research-trends

๐Ÿง Critic Chain โ€” Feedback

Score: 8/10

Strengths:
- Well-structured with clear section divisions
- Cites specific technologies and frameworks
- Professional and balanced tone

Areas to Improve:
- Could include more quantitative data
- Missing discussion of limitations and risks

One line verdict:
A solid, well-researched report that would benefit from deeper statistical analysis.

๐Ÿ”ฎ Future Enhancements

  • Iterative refinement loop โ€” Feed critic feedback back to the writer for automatic report improvement
  • Multi-source scraping โ€” Scrape multiple URLs in parallel for richer research material
  • PDF export โ€” Generate downloadable PDF reports alongside Markdown
  • Citation formatting โ€” Auto-format references in APA / IEEE style
  • Memory / conversation โ€” Allow follow-up questions on generated reports
  • Support additional LLMs โ€” Add support for Anthropic Claude, Google Gemini, and open-source models

๐Ÿ“„ License

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


Built with โค๏ธ using LangChain, OpenAI, and Streamlit

About

A Multi-Agent AI Research System Powered by LangChain

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages