Disruption Desk: flight rights with a paper trail
This is a submission for the Sanity Challenge, Path One: Ship an Agent That Queries Real Content What I Built Disruption Desk helps passengers work out what they may be entitled to after a flight disruption.
This is a submission for the Sanity Challenge, Path One: Ship an Agent That Queries Real Content
What I Built
Disruption Desk helps passengers work out what they may be entitled to after a flight disruption.
A cancellation or long delay can leave you reading regulations, airline policies and guidance pages that answer slightly different questions. Compensation, refunds and care also have different conditions. Being entitled to one does not necessarily mean you qualify for the others.
I built a flight facts form that turns those conditions into a sourced assessment. You enter the route, carrier, disruption and relevant details. The app returns an amount where it can determine one, the applicable entitlements, and the sources behind the result. Missing facts and unsupported cases stay visible.
The app covers selected passenger-rights rules for the EU, UK, US and India. Indian coverage includes cancellation, involuntary denied boarding, delay assistance and specific connecting-flight situations. Baggage results provide claims guidance; an individual loss still needs individual evidence.
The stack is Next.js 16, the Vercel AI SDK and Gemini, deployed on Vercel.
One deliberate constraint: the model cannot write the compensation amount. A calculation function applies the structured rules and returns the money, conditions and citations. Gemini retrieves content and completes the review through tools.
Demo
No login is required. You can start with an example, change the facts and run a fresh assessment.
For the production check, I submitted this case through /api/ruling:
An IndiGo domestic flight on 1 October 2026 was cancelled with no notice. The scheduled block time was 60 minutes, and the basic fare plus fuel surcharge was βΉ6,000. The passenger had a confirmed booking, provided contact details and did not accept an alternative flight. No extraordinary-circumstances defense was proven. What applies?
The result was βΉ5,000 compensation, with the ticket refund separate. It also returned refund-process and escalation guidance, citing the DGCA cancellation and refund sources stored in Sanity.
That request completed in about ten seconds with the runtime reporting FULL, google and SANITY_LIVE.
Code
The repository includes the content model, calculation code, source records and tests.
Validation included 87 passing tests, a successful typecheck and production build, and a 40-case deterministic evaluation. The evaluation is a small, curated suite, so I treat it as a regression check rather than a general claim of legal accuracy. The deployed agent was tested separately against live Sanity content.
How I Used Sanity
I pointed Sanity Context at a dedicated corpus dataset containing corpusDoc documents prepared from passenger-rights source material. These include regulations, official guidance, labeled court summaries and selected airline-policy excerpts. The documents retain source links and provenance.
The structured rules live in the production dataset. Sources, regimes, rules, compensation bands, causes and airline policies are separate documents connected by references.
The agent uses two Context MCP endpoints:
-
disruption-kbexposesknowledge_base_readfor reading the Knowledge Base. -
disruption-dataexposesgroq_queryfor querying the structured content.
The application prefixes those tool names so their origins are clear. The live production request invoked:
kb_knowledge_base_read
data_groq_query
query_rules
compute_entitlement
The first two calls retrieve through Sanity Context. The applicationβs query_rules tool then loads a fixed, parameterized GROQ dossier from Sanity, and compute_entitlement applies the conditions to the supplied flight facts.
The structure matters here. For the Indian cancellation example, the calculation needs the block-time band, basic fare plus fuel surcharge, notice period, alternative-flight choice and applicable source version. A paragraph mentioning βcancellation compensationβ does not contain enough information by itself to decide the result.
I also kept evaluation scenarios and gap records outside the retrieval scope. The agent should retrieve the rules and evidence, without seeing expected test answers.
The production response included the actual Sanity rule and source IDs behind the βΉ5,000 result. Both Context retrievals are required in full mode; a failed retrieval returns an error.
Some limits remain explicit. Court announcements are labeled as summaries, foreign-carrier compensation can need further scope review, and baggage liability ceilings are not presented as automatic payouts.
Sanity Project Details
-
production: structured sources, rules, regimes, compensation bands and related content. -
corpus: source material prepared for the Knowledge Base.
The India update added five official source records, five compensation bands, six structured rules and six corpus summaries to the existing datasets.
Agent Session
I used Codex during implementation and verification, including the Gemini integration and the India rules update.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.