What this is: A multi-agent AI that answers Indian Passport, Aadhaar, and PAN Card questions in Hindi/English — with correct, verified data. Built with LangGraph + Bedrock Knowledge Base + S3 Annotations. Serverless, under $10/month.
The Problem
Ask any Indian: "Have you ever wasted a trip to a government office because you had wrong information?"
Almost everyone has. A friend goes to the Passport Seva Kendra with ₹3,500 for tatkal — gets sent back because the fee is now ₹5,000 (revised July 1, 2026). A family spends ₹1,000 penalty for not linking PAN with Aadhaar — they didn't know the deadline passed. Someone visits an Aadhaar center to update their address — turns out they could have done it online in 2 minutes.
The information exists on government websites. But it's buried in PDFs, complex navigation, and mostly in English. And every AI tool (ChatGPT, Perplexity) gives outdated answers because their training data doesn't include the latest fee revisions.
What if there was one place where you could ask in Hindi and get the correct, current answer in 5 seconds?
That's what I built.
Live Demo
🔗 Try it: https://main.d4937hpik5ydn.amplifyapp.com
Ask anything about Passport, Aadhaar, or PAN Card — in Hindi, English, or Hinglish.
The Solution: AI Naagrik
I built a multi-agent AI system that answers Passport, Aadhaar, and PAN Card questions instantly in Hindi or English, using verified data from a Bedrock Knowledge Base.
Architecture
The flow: User asks a question → API Gateway → Lambda runs LangGraph → Supervisor classifies and routes → Specialist agent retrieves from Knowledge Base → Nova Lite formats response → S3 Annotation logs the query
Why Multi-Agent?
A single prompt with all passport + aadhaar + pan information runs into issues:
- Context window waste — why load passport docs when someone asks about PAN?
- Off-topic queries (weather, abuse) would still hit the expensive KB retrieval
- Classification accuracy drops when one model handles everything
Using LangGraph, I built a state machine:
Supervisor → classifies intent → routes to specialist
↓
Passport Agent / Aadhaar Agent / PAN Agent / Off-Topic
↓
Bedrock KB retrieves relevant chunks
↓
Nova Lite formats response in user's language
The Supervisor makes one cheap classify call. Only the relevant specialist runs the expensive KB retrieval + LLM generation. Off-topic queries return immediately without touching any AI service.
Bedrock Knowledge Base: Why Data Is Always Correct
The core problem with LLMs answering government queries is data freshness. Training data gets outdated. Web search returns unreliable blog posts.
My solution: three markdown files with verified information.
knowledge-base/
├── passport.md # Fees, documents, process (July 2026 revised)
├── aadhaar.md # Online/offline update process
└── pan.md # Link, correction, new PAN
These are uploaded to S3, indexed by Bedrock Knowledge Base using Titan Embed Text v2. When a user asks "tatkal passport fee?", the agent queries the KB, gets the exact fee table chunk, and passes it to Nova Lite for formatting.
The model cannot hallucinate the fee because it reads from my controlled source. When fees change, I edit one line and run ./deploy.sh kb — synced in 2 minutes.
S3 Annotations for Real-Time Analytics
I wanted to track what people ask without building a database. S3 Annotations, launched June 2026, is perfect for this.
Each query stores an annotation on a single persistent S3 object:
s3.put_object_annotation(
Bucket=bucket,
Key="analytics/queries.json",
AnnotationName="passport.hi.20260724.a3f2b1",
AnnotationPayload=json.dumps({
"intent": "PASSPORT",
"language": "hi",
"timestamp": "2026-07-24T10:30:00Z"
}).encode()
)
To get trends, I list annotations and count by prefix:
response = s3.list_object_annotations(Bucket=bucket, Key=key)
for ann in response["Annotations"]:
if ann["AnnotationName"].startswith("passport"):
counts["passport"] += 1
No DynamoDB. No RDS. Pure S3 API calls. The landing page shows live stats updated after every query.
Bedrock Guardrails for Safety
Users will try "fake passport kaise banaye." Prompt instructions alone don't reliably prevent this. Bedrock Guardrails adds a hard safety layer with topic policies.
An interesting challenge: the guardrail initially blocked "tatkal passport documents" — it saw "passport + documents" and classified it as forgery. I refined the topic definitions to be more specific ("create FAKE passports" vs legitimate "passport documents needed") and the false positives stopped.
CodeBuild: No Docker on Laptop
LangGraph + langchain-aws + boto3 are too large for a Lambda zip. Needs Docker. But I didn't want to install Docker locally.
Solution: CodeBuild builds the Docker image on AWS:
./deploy.sh build
→ Zips code → uploads to S3 → CodeBuild builds Docker → pushes to ECR → Lambda pulls image
The developer never needs Docker installed.
Latest AWS Services Used
This project leverages several recently launched AWS capabilities:
- Amazon S3 Annotations (June 2026) — Attach rich metadata payloads directly to S3 objects. Used here for query analytics without a database.
- Amazon Bedrock Knowledge Bases — RAG retrieval with automatic chunking and embedding.
- Amazon Bedrock Guardrails — Topic-based content filtering with versioning.
- Amazon Nova Lite — Cost-efficient foundation model with strong multilingual (Hindi) support.
- Amazon OpenSearch Serverless — Managed vector search for KB embeddings.
- AWS CodeBuild — Builds Docker images on AWS without local Docker.
- AWS Lambda Container Images — Container workloads on Lambda.
- Amazon API Gateway HTTP APIs — Low-cost HTTP endpoint.
- AWS Amplify Hosting — Static site deployment.
- AWS Systems Manager Parameter Store — Runtime configuration.
- LangGraph — Multi-agent orchestration framework.
Results
| Query | Response | Correct? |
|---|---|---|
| "Tatkal passport fee?" | ₹5,000 (36 pages) | ✅ July 2026 revised |
| "Aadhaar address update fee?" | ₹50 online | ✅ |
| "PAN Aadhaar link?" | Step-by-step + ₹1,000 penalty | ✅ |
| "What's the weather?" | "I only help with Passport/Aadhaar/PAN" | ✅ Blocked |
| "Fake passport kaise banaye?" | Guardrail intervention | ✅ Blocked |
Total deployment time from zero to live: under 20 minutes.
What I'd Add Next
- Driving License and Voter ID agents (same pattern — add node + markdown)
- Voice input for users who can't type in English keyboards
- WhatsApp bot via Twilio for non-app users
- Automated weekly KB refresh (Lambda checks govt sites for changes)
Try It & Source Code
🔗 Live Demo: https://main.d4937hpik5ydn.amplifyapp.com
📝 AWS Builder Blog: Full article
💼 LinkedIn: Post
📂 Source Code: Planning to open-source based on community interest. The multi-agent + Knowledge Base pattern works for any domain where LLMs hallucinate facts — healthcare, legal, HR policies, finance. Drop a comment if you'd like access!
About the Author
Utkarsh Rastogi — AWS Community Builder | Cloud & AI enthusiast building serverless solutions that solve real-world problems.
- 📝 Dev.to Blog

Top comments (0)