Data Science & Analysis · 2026

Israel Transit AI Agent — Conversational GTFS/SIRI Assistant

PythonLLM AgentsTool CallingDuckDBStreamlitMulti-LLM Fallback

Background

Finding out when a bus actually leaves means digging through a GTFS feed by hand — raw tables of stops, trips and calendars with no natural way to ask a simple question. Built with Tamir Edelstein of Elia Transportation Engineering for Bar-Ilan University's Data Science programme, this project wraps Israel's live GTFS/SIRI public transit data in a conversational AI agent: ask about a line's stops, operators, timetable or departure frequency in plain Hebrew or English, and get back a grounded answer plus an interactive map or chart.

This is an active, ongoing build — the agent's reasoning and guardrails are still being tightened as new edge cases surface.

Methodology

  • Built a ReAct-style tool-calling agent that orchestrates a chain of purpose-built tools — line/route disambiguation, stop lookup, timetables, departure-frequency queries and raw SQL — over a live GTFS/SIRI feed loaded into an in-memory DuckDB database.
  • Multi-provider LLM backbone (Google Gemini, Groq-hosted open models) with automatic failover: on a rate-limit or quota error the agent silently drops to the next model in a priority chain instead of surfacing an error to the user.
  • Layered deterministic guardrails around the LLM's own decisions — enforced agency/route/direction disambiguation flows, a self-verification pass that checks each draft answer against the original question, and code-built fallback logic for ambiguous schedule requests — to curb hallucination on weaker fallback models.
  • Bilingual by design: detects Hebrew vs. English from the user's message and replies in kind, while keeping GTFS names (stops, agencies, headsigns) in their original Hebrew form.
  • Real-time visual answers: auto-generated interactive Plotly route maps (stops numbered, one color per direction) the moment a line is resolved, plus departure-frequency charts and timetables, all rendered live in a Streamlit chat interface that narrates the agent's own tool calls and model switches as it works.

Results

Streamlit chat interface for the Israel Transit Agent showing a conversation about a bus line alongside an interactive route map with numbered stop markers

Chat pane on the left, live route map on the right — a route map is generated automatically the moment a line is uniquely identified.

Interactive Plotly chart showing average departures per hour for a bus line, broken down by working days, Friday and Saturday

Departure-frequency chart by hour and day type, generated on request from the live GTFS data.

The agent can already answer natural-language questions about first/last stops, operators, specific-day timetables and hourly departure frequency for any line in Israel's national GTFS feed — reasoning transparently over real data rather than a fixed FAQ, and switching models on the fly to stay available on free-tier rate limits.

Code

Still under active development — source is public on GitHub.

View repository on GitHub →