PdfAgent — Agentic RAG over any PDF
Grounded answers from your PDFs, with source citations.
Ask questions about any PDF — research reports, contracts, manuals, ESG / sustainability filings — and get grounded, cited answers. Drop a PDF into the browser UI and start asking.
Quick Start
# 1. Install
pip install agentic-rag-pdf
# 2. Install + start Ollama (https://ollama.com/download), pull the embedding model
ollama pull mxbai-embed-large
ollama signin # only if using cloud models (e.g. gpt-oss:120b-cloud)
# 3. Launch the UI
agentic-rag-pdf
Open http://localhost:8000 → click Upload PDF → drop a file → ask questions.
The same command is also installed under the shorter alias
pdfagentif you prefer less typing. Both are identical.
What it does
- Multi-modal ingestion — text, tables (extracted into SQLite), images (OCR + optional vision captions).
- Hybrid retrieval — BM25 + FAISS dense, merged with Reciprocal Rank Fusion, with optional cross-encoder reranking.
- RAPTOR hierarchical summaries for global queries; Map-Reduce for exhaustive aggregation.
- Schema-aware NL → SQL for tabular queries (SELECT-only, sandboxed).
- Hallucination defense (CRAG + 7 layers) — pre-synthesis entity-metric fact extraction, deterministic attribution check, citation verification, claim-level faithfulness, cross-chunk contradiction detection, arithmetic verification of delta tables.
- Three interfaces — browser UI (SSE-streamed agent steps), REST API, CLI.
See docs/ARCHITECTURE.md for the workflow diagram, full feature breakdown, configuration reference, REST API, and project structure.
Other ways to install
From the latest GitHub commit (handy between releases):
pip install git+https://github.com/bhagatdas/PdfAgent-Agentic-RAG-over-any-PDF.git
For development (editable, clone the repo):
git clone https://github.com/bhagatdas/PdfAgent-Agentic-RAG-over-any-PDF.git
cd PdfAgent-Agentic-RAG-over-any-PDF
pip install -e .
agentic-rag-pdf --reload
Command-line usage
The wheel installs two pairs of console scripts — long-form names that match the PyPI distribution, plus short aliases that mean the same thing:
agentic-rag-pdf # launch the browser UI (uvicorn on :8000)
agentic-rag-pdf --host 0.0.0.0 --port 8080 # custom bind
pdfagent # same thing, shorter alias
agentic-rag-pdf-cli ingest # CLI ingest (drop files in data/pdfs/ first)
agentic-rag-pdf-cli query "..." # one-shot question
agentic-rag-pdf-cli chat # interactive REPL
agentic-rag-pdf-cli schema # print the table schema catalog
pdfagent-cli ... # short alias for the same CLI
Override defaults via a .env file in your working directory. The full settings reference lives in config/settings.py.
REST API at a glance
| Method | Path | Purpose |
|---|---|---|
POST |
/query |
Run the pipeline; JSON response |
POST |
/query/stream |
Same, streamed via SSE (one event per agent) |
POST |
/upload-ingest/stream |
Wipe + ingest a single PDF |
GET |
/health |
Vector store doc count + table count |
GET |
/ollama/health |
Probe Ollama readiness + per-OS install help |
Full endpoint table and request/response shape: docs/ARCHITECTURE.md#rest-api.
Tech stack
LangGraph + LangChain · Ollama (gpt-oss:120b-cloud, mxbai-embed-large) · FAISS + rank-bm25 · cross-encoder reranker · SQLite for tables · FastAPI (SSE) · PyMuPDF · EasyOCR.
Publishing
Releases go to PyPI as agentic-rag-pdf on every v* tag push. See PUBLISHING.md for the one-time trusted-publisher setup and the tag → release flow.
License
Proprietary — see repository owner.
Built by Bhagat Kumar Das.
Metadata
Release files for agentic-rag-pdf 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agentic_rag_pdf-0.1.5.tar.gz | 135.1 kB | Without provenance | Details for agentic_rag_pdf-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentic_rag_pdf-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for agentic_rag_pdf-0.1.5-py3-none-any.whl |
Total release size: 294.0 kB
Release files / agentic_rag_pdf-0.1.5.tar.gz
| Download URL | agentic_rag_pdf-0.1.5.tar.gz |
|---|---|
| Size | 135.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6a17952c3376e69d807002163abea4b0114faff5d145b5cc48aa5afb1cf1dd3a
|
|
BLAKE2b-256 checksum How to use checksums |
0a0741a71bc9a00c234230a29af39c1a0e7198b6de19f161d9f0aef0fb95ed91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Release files / agentic_rag_pdf-0.1.5-py3-none-any.whl
| Download URL | agentic_rag_pdf-0.1.5-py3-none-any.whl |
|---|---|
| Size | 158.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
288641c40e826736a516dccb95a80fbd367cca9918908012116e8d25f5547f6e
|
|
BLAKE2b-256 checksum How to use checksums |
38a068c207135a4dab6b53f453c5e1a06ca280bd0d58b316cf615cf0276747a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.14
|
Security for agentic-rag-pdf 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.