Skip to content

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multi-Agent System

A LangChain-powered multi-agent research pipeline that automatically searches the web, reads and extracts content from relevant pages, drafts a structured report, and critiques the final output — all orchestrated through cooperating AI agents.

Live Demo: multi-agent-system-byhimanshi.streamlit.app

Overview

This project demonstrates how multiple specialized LLM agents, built with LangChain, can collaborate to complete a complex task end-to-end — turning a simple topic or question into a polished, fact-checked research report.

Instead of relying on a single prompt to do everything, the workload is split across dedicated agents, each responsible for one stage of the pipeline:

  1. Search Agent — searches the web for recent, relevant content on the given topic
  2. Reader Agent — visits the top results and scrapes/extracts the actual page content
  3. Writer Chain — synthesizes the gathered information into a structured report
  4. Critic Chain — reviews the draft, checks it for gaps or issues, and provides feedback for refinement

The system can be run either as an interactive Streamlit web app or from the command line.


Features

  • 🔍 Automated web research using an LLM-driven search agent
  • 📄 Automatic content extraction from web pages
  • ✍️ AI-generated, structured research reports
  • 🧐 Built-in critique step for quality review of the final output
  • 🌐 Simple, interactive Streamlit UI
  • 🖥️ CLI pipeline mode for running the full flow from the terminal

Architecture

User Query
    │
    ▼
┌─────────────────┐
│  Search Agent    │  → finds relevant URLs on the web
└────────┬─────────┘
         ▼
┌─────────────────┐
│  Reader Agent    │  → scrapes & extracts content from those URLs
└────────┬─────────┘
         ▼
┌─────────────────┐
│  Writer Chain    │  → drafts a structured report from the content
└────────┬─────────┘
         ▼
┌─────────────────┐
│  Critic Chain    │  → reviews the report and gives feedback
└────────┬─────────┘
         ▼
   Final Report

Each agent/chain is built using LangChain, with tool calling used to give the Search and Reader agents access to external capabilities (web search and web scraping).


📂 Project Structure

Multi-Agent-System/
├── app.py              # Streamlit web app entry point
├── pipeline.py          # CLI-based orchestration of the full pipeline
├── agents.py             # Defines the agents and chains (search, reader, writer, critic)
├── tools.py               # Custom LangChain tools (web search & web scraping)
├── requirements.txt        # Python dependencies
└── .devcontainer/            # Dev container configuration
  • app.py — Launches the Streamlit interface where a user can enter a topic and watch the pipeline run in the browser.
  • pipeline.py — Runs the same pipeline from the command line with progress printed to the console.
  • agents.py — Builds the LangChain agents/chains:
    • build_search_agent() — agent equipped with the web search tool
    • build_reader_agent() — agent equipped with the web scraping tool
    • writer_chain — prompt chain that drafts the report
    • critic_chain — prompt chain that critiques the report
  • tools.py — Implements the custom tools used by the agents:
    • a web search tool for finding relevant pages
    • a web scraping tool for extracting readable text from a page
  • requirements.txt — All Python dependencies required to run the project.

🛠️ Tech Stack

Layer Technology
Agent framework LangChain
Web interface Streamlit
Language model LLM API (e.g. OpenAI)
Web search Search API tool (e.g. Tavily)
Web scraping HTML parsing (e.g. BeautifulSoup)
Language Python

💡 Check requirements.txt for the exact set of dependencies and versions used.


🚀 Getting Started

Prerequisites

  • Python 3.9+
  • An API key for your chosen LLM provider (e.g. OpenAI)
  • An API key for your chosen search provider (e.g. Tavily), if applicable

1. Clone the repository

git clone https://github.com/Himanshi252005/Multi-Agent-System.git
cd Multi-Agent-System

2. Create a virtual environment (recommended)

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

3. Install dependencies

pip install -r requirements.txt

4. Set up environment variables

Create a .env file in the project root and add your API keys:

OPENAI_API_KEY=your_openai_api_key_here
TAVILY_API_KEY=your_tavily_api_key_here

⚠️ Never commit your .env file — make sure it's included in .gitignore.

5. Run the app

Streamlit web app:

streamlit run app.py

Or run the CLI pipeline:

python pipeline.py

💻 Usage

  1. Launch the Streamlit app (or CLI pipeline).
  2. Enter a topic or question you'd like researched.
  3. Watch as the system:
    • Searches the web for relevant sources
    • Reads and extracts content from top results
    • Drafts a structured report
    • Critiques and refines the output
  4. Review the final generated report directly in the app.

🌐 Deployment

This project is deployed on Streamlit Community Cloud and can be accessed here:

👉 multi-agent-system-byhimanshi.streamlit.app

To deploy your own version:

  1. Push your fork to GitHub.
  2. Go to Streamlit Cloud and connect your repository.
  3. Set app.py as the entry point.
  4. Add your API keys under the app's Secrets settings.

🗺️ Roadmap / Ideas for Improvement

  • Add support for multiple LLM providers
  • Export generated reports as PDF/Markdown files
  • Add memory so the system can handle follow-up queries
  • Add caching to avoid redundant searches
  • Improve error handling for failed scrapes/timeouts

🤝 Contributing

Contributions, issues, and feature requests are welcome!

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

📄 License

This project is open source. Feel free to add a license file (e.g. MIT) to clarify usage terms for others.


👤 Author

Himanshi GitHub: @Himanshi252005


⭐ If you found this project interesting, consider giving it a star on GitHub!

About

Autonomous multi-agent research pipeline (search → read → write → critique) built with LangChain, LangGraph & Groq. Live on Streamlit.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages