Skip to content

rajantripathi/smartdoc-langgraph-agent

Repository files navigation

SmartDoc LangGraph Agent

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.

What It Demonstrates

  • 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

Scope

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.


Features

  • 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

Requirements

  • Python 3.10+
  • Anaconda (recommended)
  • git
  • Hugging Face Token (required to download TinyLlama)

Installation

# 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.txt

Usage

1️⃣ CLI Version

python run_langgraph.py

2️⃣ Streamlit UI

streamlit run streamlit_app.py

Folder Structure

smartdoc-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

Notes

  • 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.

Credits

Built by Rajan Tripathi with support from LangGraph, LangChain, and HuggingFace libraries.


License

This project is licensed under the MIT License - see the LICENSE file for details.

About

LangGraph document agent for PDF question answering, tool routing, and calculator-assisted workflows

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages