Skip to main content

EaseMail: Agentic Email Automation

A 10-stage LangGraph agent that reads customer-support emails and attachments, finds the right template among hundreds, and drafts a personalised reply that is quality-checked against the customer’s booking.

  • LangGraph
  • Hybrid Retrieval · BM25
  • LLM-as-Judge
  • Presidio PII Masking
Illustrative agent run showing 10 pipeline stages and a quality-scored email draft

Built at EaseMyTrip. The interface shown is an illustrative mock-up; templates and customer data are not shown.

The problem

Support teams answer thousands of booking-related emails across 21 departments. Choosing the right reply from 434 live templates and filling it with the correct booking details by hand is slow and error-prone.

Customer emails also contain personal data and attachments such as e-tickets and scanned documents, so the system had to be accurate and privacy-safe as well as fast.

How it works

The architecture, stage by stage. Click any stage to see why it exists.

LangGraph agent · 10 stages, simplified
01 · Ingest + extract

A hybrid extraction pipeline reads native PDFs with PyMuPDF and uses RapidOCR as a fallback for scanned documents and images, so e-tickets and attachments are understood as well as the email body.

Key engineering decisions

Graph, not a chain

LangGraph made conditional routing, retries and partial re-runs explicit. Each of the 10 stages can be tested and observed on its own.

Retrieval before generation

Grounding drafts in approved templates keeps tone and policy consistent, and the LLM personalises instead of inventing.

Confidence-gated output

Drafts must pass an 85/100 quality threshold, and failing drafts get targeted feedback instead of a blind retry.

Privacy by default

Reversible PII masking means the model never sees raw personal data, but the customer still receives a fully personalised reply.

Hard problems along the way

ChallengeRegenerating whole drafts for small tweaks wasted tokens and time.

FixRun metadata and feedback loops are persisted, so drafts can be recreated and refined without repeating earlier stages.

ChallengeScanned attachments broke text-only extraction.

FixA hybrid path uses PyMuPDF first and falls back to OCR, chosen per document.

Impact

EaseMail drafts booking-aware replies across every support department, and cuts redundant API calls and LLM processing cost along the way.

Support turnaround time
−30%
Live templates covered
434
Departments
21
Quality gate threshold
85/100