Inspiration

Delhi Metro serves 6.5 million riders daily across 262 stations and 12 lines — yet getting simple commute answers still means wrestling with static PDF maps or clunky apps. Worse, when commuters turn to AI chatbots, they get confidently wrong answers: hallucinated stations, wrong line colors, and interchanges that don't exist. For someone rushing to catch the last train, a fabricated route is dangerous. We saw a gap — DMRC publishes rich, official schedule data in GTFS format, but nothing turns that data into instant, conversational, trustworthy answers. We imagined a companion that speaks the commuter's language (Hindi, Hinglish, English), knows every route and timetable by heart, and never guesses. That's how Metro Saathi was born — an AI assistant grounded entirely in real data, where every answer traces back to an actual query, not a model's memory.

What it does

Metro Saathi is a conversational Delhi Metro assistant powered by Elasticsearch Agent Builder. You can ask it natural-language questions like "How do I get from Dwarka to Shiv Vihar?" and it returns the fastest route with exact travel time, line colors, number of stops, and interchange stations. Ask "Last train from Rajiv Chowk on Sunday?" and it pulls real schedule data. Say "I'm near India Gate" and it finds the nearest metro station using geo-coordinates. It even handles Hinglish — "Rajiv Chowk se Noida jaana hai, kaunsi line?". Every answer comes from ES|QL queries over the official DMRC GTFS dataset — 262 stations, 29,130 precomputed route pairs, and 1,500+ schedule entries — so nothing is hallucinated. It supports route planning, geo-based station lookup, first/last train timings, and crowd-level predictions.

How we built it

We started with DMRC's official GTFS data (stops, routes, trips, stop_times, shapes). Using Python and NetworkX, we parsed the raw GTFS feed, built a weighted station graph, and precomputed all-pairs shortest paths — producing 29,130 station-pair routes with travel times, interchanges, and line-by-line leg summaries. We also derived crowd-level predictions from scheduled train frequency and peak-hour patterns, plus per-station headway data. All of this was bulk-indexed into Elasticsearch Cloud as structured indices: metro_stops, metro_paths, metro_schedules, metro_crowd, metro_frequencies, and metro_shapes (geo_shape for map visualization). On top of this, we built four ES|QL tools in Elastic's Agent Builder — plan_route, find_nearest_station, first_last_train, and station_info — and wired them into a single agent with a carefully crafted system prompt that enforces grounding and handles edge cases like symmetric routes.

Challenges we ran into

The biggest challenge was route symmetry — GTFS paths are stored once per station pair (A→B but not B→A), so the agent had to learn to swap origin and destination when a query returned empty, then reverse the summary. Getting this logic reliable in the system prompt took multiple iterations. ES|QL parameter syntax varied across Elasticsearch versions — ?param binding worked differently in the tool editor vs. raw queries, requiring us to adapt. Precomputing 29,130 all-pairs shortest paths from 262 stations generated ~16MB of data; bulk indexing this without timeouts required tuning chunk sizes and request timeouts. Handling ambiguous station names was tricky — "Noida" could mean Noida Sector 15, 16, 18, or Electronic City — so we added a fallback station_info tool for fuzzy matching. Finally, making the agent respond naturally in Hinglish while keeping answers data-grounded required careful prompt engineering.

Accomplishments that we're proud of

We turned Elasticsearch into a sub-50ms routing engine — no external APIs, no graph traversal at query time, just precomputed search. Every single answer Metro Saathi gives is traceable to a real ES|QL query over official DMRC data — zero hallucination by design. We processed the entire DMRC GTFS feed (128,000+ stop times, 5,400+ trips) into six purpose-built indices covering routes, schedules, crowd predictions, train frequencies, and line geometries. The agent handles English, Hindi, and Hinglish naturally. Through MCP and A2A protocols, Metro Saathi works not just in Elastic's Agent Chat but can plug into Claude Desktop, Cursor, or any compatible agent framework with zero additional code. We're especially proud that we built a genuinely useful tool — something any Delhi commuter could use right now to plan their ride with confidence.

What we learned

We learned that search engines can be intelligence engines — by precomputing the right data structures, Elasticsearch handles route planning as efficiently as any purpose-built routing service. We gained deep experience with the GTFS standard and how real transit authorities structure their data. Working with Elastic's Agent Builder taught us how ES|QL tools, when combined with a well-crafted system prompt, can create grounded AI agents that rival custom-coded solutions. We discovered that prompt engineering for tool-calling agents is fundamentally different from chat prompts — you need explicit fallback logic (like the origin/destination swap), disambiguation strategies, and strict grounding rules. We also learned the value of derived datasets — crowd prediction from train frequency, headway computation, and geo-shape indexing all added layers of insight that weren't in the raw GTFS data but emerged from thoughtful transformation.

What's next for Metro Saathi

Multimodal transit: The same GTFS pipeline can ingest DTC bus data, Rapid Metro Gurugram, and Delhi's upcoming Regional Rapid Transit — giving commuters a unified metro+bus journey planner. Real-time intelligence: Integrating live train position APIs and DMRC delay feeds to provide real-time ETAs and disruption alerts instead of static timetables. Crowd sensing: Moving from schedule-derived crowd predictions to live occupancy data from station sensors or crowdsourced reports. Accessibility features: Wheelchair-accessible route suggestions, elevator/escalator status at interchange stations, and audio-first interactions for visually impaired commuters. Multilingual expansion: Adding Punjabi, Bangla, and Tamil for migrants who form a significant portion of Delhi's metro riders. City portability: Replicating Metro Saathi for Mumbai Metro, Bengaluru Namma Metro, and Chennai Metro — any city that publishes GTFS data gets a grounded transit AI instantly.

Built With

Share this project:

Updates

Submission history