RAG + Web Search + General Chat + LangGraph Supervisor
This project implements an Agentic Retrieval-Augmented Generation (RAG) system using a three-agent architecture orchestrated by LangGraph.
It provides a clean Streamlit-based chat interface with intelligent routing between:
- A RAG agent (local PDF knowledge)
- A Web agent (internet search using Tavily)
- A General agent (conversation + reasoning)
The supervisor LLM decides dynamically which agent should handle each query.
This is an agent-based chatbot capable of:
- Answering from local PDFs using Retrieval-Augmented Generation
- Searching the internet for external information
- Handling casual chat and general reasoning
- Automatically choosing the best agent for each question
It is designed for academic, research, and technical workflows requiring both local knowledge and external information when needed.
RAG (Retrieval-Augmented Generation) retrieves relevant information from an external knowledge base—such as PDFs or documents—and feeds it into an LLM.
This significantly improves accuracy and reduces hallucinations.
Agentic AI consists of multiple specialized agents working together.
A supervisor intelligently routes user queries to the right agent, creating:
- Better accuracy
- Cleaner answers
- More dynamic behavior
This project uses three agents.
- Uses Qdrant vector DB
- Uses BGE embeddings
- Retrieves answers from your local PDFs
- Best for academic and technical questions
- Uses Tavily Search API
- Fetches online results
- Uses embeddings + LLM reasoning to pick the most relevant result
- Summarizes reliably
- Best for geography, public figures, world info, etc.
- Handles greetings, goodbyes, and casual chat
- Handles “Explain this concept” type questions
- Explains the system when explicitly asked
- Does not hallucinate content from PDFs or the web
- Place your PDFs inside the
data/folder. - Run the ingestion script to index the documents.
- Launch the Streamlit UI.
- Ask questions freely—the supervisor will route automatically:
- RAG → For document-based answers
- Web → For real-world queries
- General → For chat or simple conceptual answers
The system ensures the best agent is always chosen.
git clone <https://github.com/Shardy2907/AcademicRagSystem.git>
cd <AcademicRagSystem>pip install uvor
pipx install uvuv syncThis will create and manage a virtual environment using your pyproject.toml.
ollama pull phi3:miniollama serveRun the ingestion script to process your PDFs:
uv run src/ingest_data.pyThis will:
- Load PDFs from /data
- Split them into chunks
- Generate embeddings
- Store vectors in qdrant_local/
Create a .env file:
TAVILY_API_KEY=your_api_key_hereGet your key from:
Launch the chat interface:
uv run streamlit run src/streamlit_app.pyA browser window will open (usually at http://localhost:8501).