Document-agent prototype for PDF question answering, calculator-assisted workflows, and dynamic tool routing with LangGraph.
The repository demonstrates an enterprise-relevant agent pattern: route user requests to the right tool, retrieve evidence from uploaded documents, answer with document context when available, and fall back to a controlled utility tool for arithmetic.
- Document question answering: PDF retrieval through a LangChain vector store
- Tool routing: LangGraph workflow for selecting between document QA, calculator, and general LLM paths
- Local model path: TinyLlama-compatible setup for CPU-friendly experimentation
- Reviewer UI: Streamlit interface for testing document and tool-routing behavior
- Extensible agent design: Small codebase that can be replaced with stronger models, rerankers, or enterprise document stores
This is a compact agent prototype, not a production document platform. A production version would add authentication, document-level access control, citation enforcement, structured logging, evaluation sets, and model/embedding observability.
- PDF document question answering
- Calculator for simple math queries
- General-purpose LLM question answering
- Dynamic routing via LangGraph
- Streamlit UI for local review
- Hugging Face Transformers compatibility
- CPU-friendly local execution path
- Python 3.10+
- Anaconda (recommended)
- git
- Hugging Face Token (required to download TinyLlama)
# Clone this repo
https://github.com/rajantripathi/smartdoc-langgraph-agent.git
cd smartdoc-langgraph-agent
# Create virtual environment (Recommended)
conda env create -f environment.yml
conda activate agentenv
# Or install manually
pip install -r requirements.txtpython run_langgraph.pystreamlit run streamlit_app.pysmartdoc-langgraph-agent/
├── agent.py
├── langgraph_agent.py
├── pdf_reader.py
├── pdf_qa_tool.py
├── tools.py
├── tool_selector.py
├── run_langgraph.py
├── streamlit_app.py
├── requirements.txt
├── environment.yml
├── data/
│ └── sample.pdf
└── .env.example
- The project demonstrates a small but clear LangGraph routing pattern.
- TinyLlama can be replaced with another Hugging Face-compatible model.
- The code is intentionally compact so the orchestration logic is easy to inspect.
Built by Rajan Tripathi with support from LangGraph, LangChain, and HuggingFace libraries.
This project is licensed under the MIT License - see the LICENSE file for details.