Multi-Agent RAG — Grounded Research Assistant

Problem Statement

Students and researchers spend an enormous amount of time manually reading through research papers just to understand a new topic or complete a literature review. When they turn to general-purpose AI chatbots for help instead, those tools often hallucinate — they generate confident, well-written answers that sound correct but may not actually be true, which is especially dangerous in an academic setting where accuracy matters.

General models like ChatGPT and Claude also answer from what they learned during training rather than looking inside a specific set of documents — ask them about a private paper or anything not publicly available, and they either don't know, or worse, guess and sound confident about something wrong.

On top of that, most AI research tools are built for people who already understand the subject, which leaves out exactly the people who need the most help: students new to a field who don't yet know its vocabulary.

Solution Overview

Multi-Agent RAG is a research assistant built around one core idea:

The AI has to prove its own answer is correct before showing it to you, rather than asking you to simply trust it.

It answers questions using a real, growing library of research papers, and a dedicated Critic agent checks every draft answer against the actual retrieved source material before it's ever shown to the user.

If the answer isn't well-supported, the system rewrites the question and tries again rather than returning an unverified guess — and if nothing in the corpus actually answers the question, it says so honestly instead of inventing something.

On top of that, the system can autonomously search academic databases, download and read open-access papers on a given topic, and write a fully-cited literature review on its own.

Key Features

Grounded Q&A

Every answer shows:

  • A GROUNDED / UNGROUNDED badge
  • Response time
  • Full agent trace
  • Topic searched
  • Sub-questions generated
  • Exact source documents used
  • Clickable snippet previews
  • Full PDF links to source documents

Explain Simply

The same accurate, cited answer rewritten in plain, beginner-friendly language.

Autonomous Literature Review Generator

Give it a topic, and it:

  • Searches arXiv and Semantic Scholar
  • Ingests open-access papers
  • Writes a themed, structured literature review
  • Includes per-claim citations
  • Generates APA or IEEE bibliography
  • Exports directly to PDF

Flexible Document Ingestion

Upload:

  • PDFs
  • TXT files
  • Markdown files
  • ZIP archives (automatically extracted)
  • Raw pasted text

Live Usage Dashboard

Displays:

  • Real grounded-rate percentage
  • Corpus size
  • Conversation trends
  • Trending topics
  • Literature review history

All metrics are calculated from actual usage.

Full Conversation History

  • Searchable
  • Renameable
  • Deletable
  • Exportable

Technologies Used

  • Python
  • LangGraph
  • LangChain
  • FastAPI
  • Django
  • ChromaDB
  • rank_bm25
  • sentence-transformers (cross-encoder reranking)
  • OpenAI GPT-4o-mini
  • OpenAI text-embedding-3-small
  • arXiv API
  • Semantic Scholar API
  • fpdf2
  • RAGAS
  • Docker
  • PostgreSQL
  • Render

Target Users

Students and researchers who need to work with a specific, private, or specialized collection of documents rather than an AI's general training knowledge — particularly students new to a field who benefit from both verified accuracy and the plain-language explanation mode.

It's equally useful for anyone doing a literature review who wants a first-pass, properly cited summary of a topic before diving into the full papers themselves.

Inspiration

Students and researchers spend an enormous amount of time manually reading through research papers just to understand a new topic or complete a literature review.

When they turn to general-purpose AI chatbots for help instead, those tools often "hallucinate" — they generate confident, well-written answers that sound correct but may not actually be true, which is especially dangerous in an academic setting where accuracy matters.

General models like ChatGPT and Claude also answer from what they learned during training — they don't actually look inside your specific documents. Ask them about a private paper, an internal report, or anything not publicly available, and they either don't know, or worse, they guess and sound confident about something wrong.

On top of that, most AI research tools are built for people who already understand the subject. That leaves out exactly the people who need the most help: students who are new to a field and don't yet know its vocabulary.

We wanted to build something around one core idea instead:

The AI should have to prove its own answer is correct before showing it to you, rather than asking you to simply trust it.

What It Does

Chat

Multi-Agent RAG lets you ask questions across a growing library of research papers — organized into topic areas — and get back answers that are genuinely grounded in real source material, not guessed.

If the system can't find a real answer in its documents, it says so honestly instead of making something up.

Every answer comes with:

  • A visible GROUNDED / UNGROUNDED badge
  • Response time
  • One-click copy button
  • Thumbs up/down feedback
  • Full agent trace

The trace shows:

  • Which topic areas were searched
  • What sub-questions were generated
  • Which source documents were used

Every source document is clickable and includes:

  • Expandable snippet previews
  • Exact passages cited
  • Full PDF links

Explain Simply

A toggle that rewrites the same accurate, cited answer in plain, beginner-friendly language, so it helps newcomers to a field just as much as people who already know the vocabulary.

Literature Review Generator

Give it a topic string and it builds its own mini-corpus autonomously:

  1. Searches arXiv and Semantic Scholar
  2. Downloads available open-access papers
  3. Ingests them automatically
  4. Writes a structured literature review

The review includes:

  • Overview
  • Key themes
  • Research gaps
  • Per-claim citations

Every citation is tied to a paper the system actually downloaded and read — not generated from general knowledge.

The bibliography can be formatted in:

  • APA
  • IEEE

The finished review is exportable as a downloadable PDF.

Past reviews are saved and can be reopened instantly without rerunning the search.

Upload Documents

Users can upload:

  • PDFs
  • TXT files
  • Markdown files
  • ZIP archives

or simply paste text directly.

Documents can be added to new or existing topic areas and become searchable immediately without restarting the system.

Dashboard

The dashboard includes:

  • Live grounded-rate percentage
  • Corpus size
  • 14-day conversation trends
  • Trending topics
  • Most-cited papers
  • Literature review counts
  • Recent review history

History

Every conversation is:

  • Searchable
  • Renameable
  • Deletable
  • Exportable as Markdown

The entire interface is mobile responsive and works on both desktop and mobile devices.

How We Built It

The core system is built with LangGraph and wires seven specialized agents together as a state machine with a real decision point rather than a simple linear workflow.

Contextualizer
      ↓
Router
      ↓
Planner
      ↓
Retriever
      ↓
Synthesizer
      ↓
Critic
      ↓
 Approved?
   ↙     ↘
 Yes      No
  ↓        ↓
Answer  Rewriter
            ↓
       Retriever

Agent Responsibilities

Contextualizer Resolves follow-up questions using chat history.

Router Chooses which topic domain should be searched.

Planner Breaks complex questions into focused sub-questions.

Retriever Performs hybrid retrieval using BM25 keyword search fused with dense vector retrieval through Reciprocal Rank Fusion, optionally reranked using a cross-encoder.

Synthesizer Generates a cited answer and streams it token-by-token.

Critic Verifies whether the generated answer is actually supported by retrieved evidence.

Rewriter Uses critic feedback to reformulate weak queries and retry retrieval (capped at one retry).

Literature Review Pipeline

The Literature Review feature runs a separate workflow on top of the same retrieval infrastructure.

It:

  1. Queries arXiv and Semantic Scholar in parallel
  2. Deduplicates papers by normalized title
  3. Downloads available open-access papers
  4. Creates a uniquely timestamped research domain
  5. Generates a structured review from retrieved evidence
  6. Builds APA or IEEE citations
  7. Exports the review to PDF

System Architecture

The backend is a FastAPI service that streams responses using Server-Sent Events (SSE).

The user-facing application is a Django dashboard that never interacts directly with the agents or vector database. Instead, it communicates through FastAPI, allowing the two services to be deployed independently.

Uploads, ZIP extraction, pasted text, and literature-review ingestion all share the same ingestion pipeline, ensuring every document becomes searchable in a consistent way.

Deployment uses:

  • Render
  • Docker
  • PostgreSQL
  • Persistent disk storage

The persistent disk preserves the vector database and uploaded documents across deployments and service restarts.

Challenges We Ran Into

LangGraph State Management

One of the trickiest early bugs came from the Explain Simply feature.

The value was correctly passed:

Frontend → Django → FastAPI

Yet it kept disappearing.

The root cause was that LangGraph only preserves state fields explicitly declared in its shared schema. The value was reaching the graph correctly but was silently discarded as execution moved between agents.

The fix was a single missing state-field declaration, but identifying it required tracing requests across the entire system.

Production Deployment Challenges

Deployment surfaced a much larger series of issues:

  • Render memory limits forced the cross-encoder reranker to be disabled by default.
  • Chroma's vector database initially failed to persist across container restarts.
  • Initial corpus seeding required a one-time embedding process.
  • Concurrent workers corrupted the vector index by writing simultaneously.
  • Embedding large document collections exceeded available memory.
  • Malformed PDFs created empty chunks that crashed retrieval.
  • Long-running literature review jobs exceeded Gunicorn's default timeout.

Many of these problems never appeared locally and only surfaced under real production conditions.

Secure ZIP Uploads

Supporting ZIP uploads required defending against:

Zip-Slip Attacks

Malicious archive entries such as:

../../etc/evil.txt

that attempt path traversal.

Zip Bombs

Tiny archives that expand into massive amounts of data when extracted.

The system mitigates these risks by:

  • Stripping extracted paths to safe basenames
  • Validating ZIP metadata before extraction
  • Limiting individual file sizes
  • Limiting total extracted archive size

Accomplishments That We're Proud Of

The grounding verification system is not just cosmetic.

When asked a question completely outside its document corpus, the system did not hallucinate an answer. Instead, it correctly stated that the provided context did not contain sufficient information.

Importantly, that refusal was still marked as GROUNDED because refusing to invent unsupported information is the trustworthy behavior.

We also successfully extended this verification-first philosophy beyond Q&A into literature reviews, ensuring every generated claim is tied to a paper that the system actually downloaded and analyzed.

Finally, we're proud of deploying the entire system end-to-end and debugging multiple production-only issues that never appeared during local development.

What We Learned

The biggest lesson was that a true multi-agent system is not simply multiple AI calls connected together.

A multi-agent architecture becomes meaningful when one agent is allowed to evaluate, challenge, and correct another.

The Critic-and-Retry loop became the defining feature that differentiates this project from a standard chatbot and proved worth the additional complexity.

We also learned a great deal about:

  • Shared state management in agent systems
  • Building transparent traces that improve user trust
  • Sizing cloud infrastructure realistically
  • Understanding deployment costs
  • Managing concurrent workers
  • Persistent storage
  • Production timeouts

Most importantly, we learned that software working perfectly on a local machine guarantees nothing about how it behaves under real deployment conditions.

What's Next for Multi-Agent RAG — Grounded Research Assistant

Future improvements include:

  • Expanding the document library into additional domains
  • Continuously tracking RAGAS evaluation metrics
  • Supporting per-user private document collections
  • Building richer analytics and trend-discovery capabilities
  • Expanding usage insights beyond the current dashboard

Built With

Share this project:

Updates