AWS Builder Center

Building a Multi-Agent AI for Indian Citizen Services Using LangGraph, Amazon Bedrock Knowledge Base, and S3 Annotations

A multi-agent system that answers Passport, Aadhaar, and PAN Card questions in Hindi and English using verified data. Built with LangGraph for orchestration, Bedrock Knowledge Base for agentic RAG retrieval, S3 Annotations for real-time analytics, Bedrock Guardrails for safety, and deployed serverlessly on Lambda via CodeBuild — all under $10/month.

AWS Community Builder | Cloud Specialist (AWS) | Helping Teams Build Scalable, Secure Cloud Solution
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

Live demo was active during initial launch. Infrastructure has been taken down to manage AWS costs. Screenshots and architecture details below show the full working system.
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:
1
2
3
4
5
6
7
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.
1
2
3
4
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:
1
2
3
4
5
6
7
8
9
10
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:
1
2
3
4
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:
1
2
./deploy.sh build
→ Zips code → uploads to S3 → CodeBuild builds Docker → pushes to ECR → Lambda pulls image
The developer never needs Docker installed.

Architecture Summary

Latest AWS Services Used

This project leverages several recently launched AWS capabilities:

Framework

  • LangGraph  — Multi-agent orchestration framework with state machine routing.
ServicePurpose
Amazon Bedrock (Nova Lite)LLM for response generation
Bedrock Knowledge BaseRAG retrieval from verified docs
Bedrock GuardrailsBlocks forgery/abuse
OpenSearch ServerlessVector store for KB
S3 + S3 AnnotationsQuery analytics
Lambda (Container)Runs multi-agent code
CodeBuild + ECRCI/CD without local Docker
API Gateway (HTTP)REST endpoint
AmplifyFrontend hosting
SSM Parameter StoreConfig management
LangGraphMulti-agent orchestration

Results

QueryResponseCorrect?
"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.

Try It & Source Code

📂 Source Code: Planning to open-source based on community interest. If you'd like access to the full codebase, drop a comment or connect with me on LinkedIn .
The multi-agent + Knowledge Base pattern works for any domain where LLMs hallucinate facts — healthcare, legal, HR policies, finance. Let me know what you'd build with it!

About the Author

Utkarsh Rastogi — AWS Community Builder | Cloud & AI enthusiast building serverless solutions that solve real-world problems for Indian citizens.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article