Skip to content
HS®
All projects

(001) / 012

BookingAgent

A flight search and booking platform for travel agents that queries several suppliers in parallel and never lets a language model set a price.

Category
Full-stack platform · AI assistant
Year
2026
Last pushed
Oct 2026
Primary language
Python
Conceptual diagram — one query fanning out to four suppliers, one timing out, results merged and ranked.

(01) Overview

Booking Agent is a flight search and booking platform for travel agents. An agent describes a trip in plain language or fills in a search form; the platform asks several suppliers at once, turns every answer into one offer format, prices it in INR with the agency's markup, and shows the best options side by side.

It runs on demo data only: three simulated suppliers and the Duffel sandbox. No real money moves and no tickets are issued, and the interface labels simulated results as such.

(02) Problem statement

Fares for the same trip come from many suppliers, each with its own API, format, currency and failure behaviour. An agent comparing them by hand is slow, and a single slow supplier can stall the whole search.

Adding an AI assistant raises a second problem: a language model that invents a price, or books something on its own, is worse than no assistant at all.

(03) Technical approach

The system is split so that each risk has one owner:

  • Connectors hide supplier differences behind a single Offer model.
  • An orchestrator owns parallelism, timeouts and partial failure.
  • A rules engine owns pricing, in code.
  • The assistant gets read-only tools and nothing else.
  • Booking is a separate, human-confirmed step that always re-prices live.

(04) System architecture

A search travels from the Next.js client through FastAPI to the orchestrator, which fans out to every enabled supplier and streams results back as each one finishes.

Search request pathConceptual diagram · select a stage

Stage 01 — Web app

Next.js client sends a structured search, or a plain-language request to the assistant.

(05) Implementation details

Results stream to the browser over Server-Sent Events, with a status strip showing which suppliers answered, failed or timed out — partial failure is shown, never hidden. Non-INR prices are converted with ECB rates, and the original currency, rate and timestamp are kept for audit. Money is always a Decimal with a currency code, never a float.

The assistant exposes four read-only tools: search_flights, get_offer_details, compare_offers and explain_ranking. Offer cards are priced by the backend, and the model's reply is checked against tool results so invented prices are rejected. Passenger details are entered only in the booking form and never reach the model.

(06) Main features

  1. 01One-way, return and multi-city search (up to six flights) with cabin, passenger and time-of-day options.
  2. 02Results stream in supplier by supplier over Server-Sent Events, with a status strip showing which suppliers answered, failed or timed out.
  3. 03Duplicate fares from different suppliers are merged into one card.
  4. 04Best-value ranking adjusts price for baggage and refundability, computed in code.
  5. 05An AI assistant with read-only tools searches, compares and explains trade-offs — it cannot book.
  6. 06Booking always re-prices live and needs a separate confirmation tied to that exact price.
  7. 07Multi-tenant data model with an agency markup engine and role-based views.

(07) Technology stack

Python 3.12FastAPIPydantic v2SQLAlchemy 2 (async)AlembicPostgreSQL / SQLiteRedisNext.js 16React 19TypeScriptTailwind CSS 4Groq LLMDuffel API (sandbox)pytestPlaywright

(08) Engineering challenges

  • Partial failure. Each supplier has a 7-second timeout, a circuit breaker and a concurrency limit, so one bad supplier degrades the result set instead of blocking it.
  • Keeping the model honest. Each model call is capped at 20 seconds with one retry, each turn at 45 seconds and three tool rounds, and only the top five offers are sent to the model.
  • Stale prices. Cached prices are treated as a display hint. Booking re-prices live and needs a confirmation tied to that exact price and passenger list.
  • Duplicates. The same fare arriving from two suppliers is merged into one card rather than shown twice.

(09) Evaluation and results

The repository documents its test coverage rather than performance figures. A load test script (100 concurrent searches) is included, but no measured numbers are published, so none are quoted here.

Test suite described in the repository
Backend tests~770unit, API and integration (pytest)
Assistant eval scenarios32run against a scripted model
Type checkingmypy strict
Web testsPlaywrightAPI mocked

Source: README · Testing