Skip to content

saikumarreddy2001/multi-agent-research

Repository files navigation

title Multi-Agent Research Assistant
emoji 🧠
colorFrom blue
colorTo indigo
sdk streamlit
sdk_version 1.39.0
app_file app.py
pinned false
license mit

Multi-Agent Research Assistant

A multi-agent system where four specialized AI agents collaborate to research any topic — one searches the web, one summarizes findings, one fact-checks claims, and one writes the final structured report. Orchestrated with LangGraph and powered by Groq running llama-3.3-70b-versatile (the current production replacement for the now-decommissioned llama3-70b-8192). You can override the model at any time by setting GROQ_MODEL in .env.

Architecture

                  ┌──────────────────────────────┐
                  │      User research topic     │
                  └──────────────┬───────────────┘
                                 │
                                 ▼
                  ┌──────────────────────────────┐
                  │       1. Search Agent        │
                  │     (Tavily web search)      │
                  └──────────────┬───────────────┘
                                 │ top 5 results
                                 ▼
                  ┌──────────────────────────────┐
                  │     2. Summarizer Agent      │
                  │   (Groq · llama3-70b-8192)   │
                  └──────────────┬───────────────┘
                                 │ structured summary
                                 ▼
                  ┌──────────────────────────────┐
                  │     3. Fact-Check Agent      │
                  │  (claims + Tavily evidence)  │
                  └──────────────┬───────────────┘
                                 │ VERIFIED / UNVERIFIED / DISPUTED
                                 ▼
                  ┌──────────────────────────────┐
                  │      4. Writer Agent         │
                  │  (final structured report)   │
                  └──────────────┬───────────────┘
                                 │
                                 ▼
                  ┌──────────────────────────────┐
                  │   outputs/reports/*.txt      │
                  │   logs/research_log.json     │
                  └──────────────────────────────┘

If any node sets state["error"], the graph short-circuits to END gracefully and the UI surfaces the failure.

Project Structure

multi-agent-research/
├── agents/
│   ├── __init__.py
│   ├── search_agent.py
│   ├── summarizer_agent.py
│   ├── factcheck_agent.py
│   └── writer_agent.py
├── graph/
│   ├── __init__.py
│   ├── state.py
│   └── pipeline.py
├── frontend/
│   └── app.py
├── utils/
│   ├── __init__.py
│   └── helpers.py
├── logs/
│   └── research_log.json
├── outputs/
│   └── reports/
├── .env
├── requirements.txt
└── README.md

Setup

  1. Clone / open the project and cd into multi-agent-research/.

  2. Create a virtual environment (recommended)

    python -m venv .venv
    # Windows
    .venv\Scripts\activate
    # macOS / Linux
    source .venv/bin/activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Configure your API keys in .env

    GROQ_API_KEY=your_groq_key_here
    TAVILY_API_KEY=your_tavily_key_here

Run

Streamlit UI (recommended)

# Either file path works — they share the same main()
streamlit run app.py
# or
streamlit run frontend/app.py

Open the printed http://localhost:8501 URL, type a topic, click Start Research, and watch the four-step progress tracker fill in.

Use the sidebar to swap models, change the number of search results, adjust how many claims to fact-check, and browse past reports.

Deploy

See DEPLOYMENT.md for step-by-step deploys to Streamlit Community Cloud, Hugging Face Spaces, and Docker (Render / Railway / Fly.io / Cloud Run).

Headless / programmatic

from graph.pipeline import run_pipeline

result = run_pipeline("artificial intelligence trends 2024")
print(result["status"])
print(result["final_report"])

A timestamped .txt copy of every report is saved under outputs/reports/, and a summary of each run is appended to logs/research_log.json.

Example Topics

  • artificial intelligence trends 2024
  • quantum computing breakthroughs 2024
  • state of renewable energy in 2024
  • latest developments in CRISPR gene editing
  • large language model evaluation benchmarks
  • state of fusion energy research
  • Mars exploration missions 2024
  • cybersecurity threats facing the financial industry

How Each Agent Works

1. Search Agent — agents/search_agent.py

Uses the Tavily client to run an advanced search and returns up to 5 results, each normalized to {title, url, content}. Any Tavily failure yields a graceful fallback result so downstream agents still have something to work with.

2. Summarizer Agent — agents/summarizer_agent.py

Sends the raw search results to llama-3.3-70b-versatile via Groq with a research-summarizer system prompt that requires the output to contain Key Findings, Important Statistics, and Main Themes.

3. Fact-Check Agent — agents/factcheck_agent.py

  1. Asks the LLM to extract 5 atomic, independently verifiable claims from the summary.
  2. Searches Tavily for evidence on each claim.
  3. Asks the LLM to label each claim as VERIFIED, UNVERIFIED, or DISPUTED and to cite the strongest snippet.

4. Writer Agent — agents/writer_agent.py

Feeds the summary, fact-check verdicts, and original sources to the LLM and asks for a full report with these sections: Executive Summary, Key Findings, Verified Facts, Areas of Uncertainty, Conclusion. The result is automatically saved to outputs/reports/<timestamp>_<topic>.txt.

State Schema

class AgentState(TypedDict, total=False):
    topic: str
    search_results: list
    summary: str
    fact_check: dict
    final_report: str
    status: str
    error: str
    report_path: str

Logging

Every pipeline run appends a JSON record to logs/research_log.json:

{
  "timestamp": "2026-05-20T01:23:45",
  "topic": "artificial intelligence trends 2024",
  "status": "success",
  "error": "",
  "search_result_count": 5,
  "summary_length": 1842,
  "fact_check_summary": {
    "verified": 3,
    "unverified": 1,
    "disputed": 1,
    "total": 5
  },
  "report_length": 4321,
  "total_time_seconds": 17.412
}

Known Limitations

  • Tavily free tier has monthly request caps and rate limits. The fact-check agent issues one Tavily request per claim, so a single run uses ~6 requests.
  • LLM hallucination: even with fact-checking, summaries and reports can contain inaccuracies — always treat the output as a starting point, not a final source of truth.
  • JSON parsing of LLM output in the fact-check agent is best-effort. If the model returns malformed JSON, the agent falls back to line-based parsing or marks the claim as UNVERIFIED.
  • No persistent agent memory — every run starts fresh.
  • English-first: prompts and parsing assume English; non-English topics may work but quality is not validated.
  • sentence-transformers is listed as a dependency for the all-MiniLM-L6-v2 embeddings model (downloaded on first use). It is imported lazily so the pipeline still runs if the model has not yet been pulled.
  • Groq rate limits apply per minute / per day depending on your account tier.

About

Multi-agent AI system that researches any topic — searches the web, summarizes, fact-checks, and writes a structured report. Built with LangGraph, Groq, and Tavily.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages