How snehilsaxena29/scholar-agent works
Scholar-Agent is a web application for producing literature reviews grounded in retrieved academic papers. A user submits a question; the backend finds papers, extracts and indexes passages, critiques and drafts a review, then verifies it and links sentences to evidence. The frontend streams agent progress, displays the report and sources, and optionally saves runs for signed-in users. The README documents the agent workflow and alternate vector stores; unsampled implementation details are represented only where the source index or documentation supports them.
Main entry points: build.py Research graph · Research.jsx Research form · librarian.py Librarian · main.py FastAPI routes
Components 30
Research interface
- Research form
frontend2/src/pages/Research.jsx - API client
frontend2/src/lib/api.js - Agent trace
frontend2/src/components/AgentTrace.jsx - Report display
frontend2/src/components/ReportView.jsx - Report annotations
frontend2/src/components/AnnotatedReport.jsx - Evidence view
frontend2/src/components/EvidenceView.jsx - Report export
frontend2/src/components/ExportBar.jsx - Auth context
frontend2/src/lib/AuthContext.jsx - Research history
frontend2/src/pages/History.jsx
API and persistence
- FastAPI routes
backend2/app/main.py - Research graph
backend2/app/graph/build.py - Session database
backend2/app/db/models.py
Paper retrieval
- Paper search
backend2/app/ingestion/fetch.py - PDF parsing
backend2/app/ingestion/parse.py - Text chunking
backend2/app/ingestion/chunk.py - Embeddings
backend2/app/ingestion/embed.py - Vector retrieval
backend2/app/ingestion/vectorstore.py
Review agents
- Librarian
backend2/app/graph/nodes/librarian.py - Skeptic
backend2/app/graph/nodes/skeptic.py - Synthesizer
backend2/app/graph/nodes/synthesizer.py - Supervisor
backend2/app/graph/nodes/supervisor.py - Research state
backend2/app/graph/state.py - LLM provider client
backend2/app/graph/llm.py
Evidence and evaluation
- Evidence linking
backend2/app/graph/nodes/evidence.py - Evidence matching
backend2/app/eval/evidence.py - Run evaluation
backend2/app/eval/metrics.py
Other components
- Researcher
- Supabase auth
- Academic paper services
- Groq
Connections 37
- Researcher → Research form: submits question
frontend2/src/pages/Research.jsx - Research form → API client: starts stream
frontend2/src/pages/Research.jsx - API client → FastAPI routes: requests research
- FastAPI routes → Research graph: runs graph
backend2/app/main.py - FastAPI routes → Research graph: streams updates
backend2/app/main.py - Research graph → Librarian: dispatches
backend2/app/graph/build.py - Research graph → Skeptic: dispatches
backend2/app/graph/build.py - Research graph → Synthesizer: dispatches
backend2/app/graph/build.py - Research graph → Supervisor: dispatches
backend2/app/graph/build.py - Research graph → Evidence linking: dispatches
backend2/app/graph/build.py - Librarian → Paper search: fetches papers
backend2/app/graph/nodes/librarian.py - Paper search → Academic paper services: searches
- Librarian → PDF parsing: parses papers
backend2/app/graph/nodes/librarian.py - Librarian → Text chunking: chunks text
backend2/app/graph/nodes/librarian.py - Librarian → Vector retrieval: indexes and searches
backend2/app/graph/nodes/librarian.py - Vector retrieval → Embeddings: uses vectors
backend2/app/ingestion/vectorstore.py - Librarian → Research state: updates retrieval state
backend2/app/graph/nodes/librarian.py - Skeptic → LLM provider client: gets model
backend2/app/graph/nodes/skeptic.py - Synthesizer → LLM provider client: gets model
backend2/app/graph/nodes/synthesizer.py - Supervisor → LLM provider client: gets model
backend2/app/graph/nodes/supervisor.py - LLM provider client → Groq: invokes model
- Research graph → Research state: passes state
backend2/app/graph/build.py - Supervisor → Synthesizer: retries draft
backend2/app/graph/build.py - Evidence linking → Evidence matching: matches passages
backend2/app/graph/nodes/evidence.py - FastAPI routes → Run evaluation: scores run
backend2/app/main.py - Run evaluation → LLM provider client: judges with model
backend2/app/eval/metrics.py - Run evaluation → Embeddings: compares vectors
backend2/app/eval/metrics.py - FastAPI routes → Session database: reads and saves history
backend2/app/main.py - Research form → Agent trace: renders progress
frontend2/src/pages/Research.jsx - Research form → Report display: renders result
frontend2/src/pages/Research.jsx - Report display → Report annotations: renders draft
frontend2/src/components/ReportView.jsx - Report display → Evidence view: renders evidence
frontend2/src/components/ReportView.jsx - Research form → Report export: offers export
frontend2/src/pages/Research.jsx - Auth context → Supabase auth: gets auth session
frontend2/src/lib/AuthContext.jsx - Research history → Auth context: reads session
frontend2/src/pages/History.jsx - Research history → API client: loads history
frontend2/src/pages/History.jsx - Research form → API client: saves signed-in run
frontend2/src/pages/Research.jsx