Skip to content

AI Researcher & Engineer

1 Publications

4 Projects

  • PyTorch
  • TensorFlow
  • HuggingFace
  • LangChain
  • LangGraph
  • FastAPI
  • OpenCV
  • YOLOv8
  • FAISS
hamza35502@gmail.com
Get in touchRésumé
HAMZA
RésuméGet in touch
Menu
hamza35502@gmail.com
  • PyTorch
  • TensorFlow
  • HuggingFace
  • LangChain
  • LangGraph
  • FastAPI
  • OpenCV
  • YOLOv8
  • FAISS
Work
Engineering

Tax Sathi — Agentic Tax Assistant for Pakistan

Agentic assistant that turns a plain-English or Urdu description of income into a full Pakistani income-tax calculation, with FBR section citations and an auditable reasoning trace.

Key numbers

  • 4

    Pipeline stages

    extraction, retrieval, interpretation, calculation

  • 80+

    Indexed ordinance sections

    tree index over the Income Tax Ordinance 2001

  • 2025-26

    Tax year covered

Problem

Pakistani tax law is sprawling, amended every year and hard for non-experts to apply. Someone earning from salary, rent, bank profit and capital gains faces overlapping sections, schedules, exemptions, withholding rules and filer/non-filer rates. Tax Sathi lets a taxpayer describe their situation in plain English or Urdu and get a complete FY 2025-26 calculation under the Income Tax Ordinance 2001, with every step traceable to the law.

Approach

A LangGraph state machine routes each message by intent, then chains four modules. An LLM extracts structured income data and asks follow-up questions when it is incomplete; a two-pass tree-index retriever selects the relevant ordinance sections and follows their cross-references; an LLM makes only the legal classification decisions; deterministic Python computes the tax from hardcoded FY 2025-26 rate tables.

Results

  • Computes slab tax, minimum tax, super tax and withholding adjustments for FY 2025-26, with each figure tied to the ordinance section it comes from.
  • Answers FBR policy questions grounded in the Income Tax Ordinance 2001, citing section numbers, schedules and deadlines.
  • Reads salary slips, withholding certificates and challans through a vision model and feeds the figures into the same pipeline.
  • Shows the full reasoning trace (extraction → retrieval → interpretation → calculation) in a live panel, with multi-session history.

Design decisions

The LLM classifies, Python calculates. LLMs are unreliable at arithmetic: they can apply the wrong rate, miss a bracket or round incorrectly. The model only decides questions of law (which income head, which regime, which schedule, whether a deduction applies), and the tax itself is computed by deterministic code from the First Schedule rate tables, so every number is reproducible.

A tree index instead of vector search. The ordinance is strictly hierarchical (chapters, parts, divisions, sections). Vector search treats sections as flat and can return text that is similar but legally irrelevant. Here the model reasons over the tree's titles and summaries to pick sections, a second pass fetches sections they cross-reference, and content is read by line range.

A state machine for the conversation. LangGraph makes the clarification loop explicit: when income data is incomplete the graph asks targeted questions and routes back to extraction, and each step stays an independent, inspectable node.

Limitations

  • Prompts are tuned for individuals; complex association-of-persons and corporate cases can be misclassified.
  • PDF export and share links are not implemented yet.
  • No rate limiting on the pipeline endpoint, and allowed origins are set for local use only.

Project details

Type
Engineering
Year
2026
Status
Completed
Role
Solo; designed and built the whole system, from the agent pipeline and law retrieval to the calculator, backend and web app.
Domains
  • Agentic AI
  • RAG
  • LLMs
Technologies
  • Python
  • LangGraph
  • LiteLLM
  • Groq LLaMA 3.3 70B
  • FastAPI
  • Pydantic
  • Supabase
  • React