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.
- ๐ 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.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 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 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
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
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.
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.
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.
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.
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.
- Python
- LangChain
- LangChain Agents
- LCEL
- ChatPromptTemplate
- StrOutputParser
- 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.
- Tavily
- Requests
- BeautifulSoup4
- 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.
- python-dotenv โ Loads API keys from
.env - uv โ Python environment and package management
- rich โ Formatted terminal output
- VS Code โ Development environment
Before running the project, make sure you have:
- Python 3.10+
- OpenAI API key
- Tavily API key
- Internet connection
uvorpip
Download the repository and extract it.
Then open the project directory:
cd Multi-agent-research-systemUsing uv:
uv venvActivate the environment:
macOS / Linux
source .venv/bin/activateWindows
.venv\Scripts\activateUsing uv:
uv pip install -r requirements.txtOr using pip:
pip install -r requirements.txtCreate a .env file in the project root:
OPENAI_API_KEY="your_openai_api_key"
TAVILY_API_KEY="your_tavily_api_key"
โ ๏ธ Never commit your.envfile or expose your API keys publicly.
Start the Streamlit application:
streamlit run app.pyThe application will open in your browser.
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
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
| 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 |
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
Vamsi Kanithi
A project exploring multi-agent AI systems, LLM orchestration, automated web research, and agentic workflows.