# ahmedsheikh27/air-travel-agent architecture

> Architecture diagram of the GitHub repository ahmedsheikh27/air-travel-agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ahmedsheikh27/air-travel-agent
- Repository: https://github.com/ahmedsheikh27/air-travel-agent

## Overview

Air Travel Agent is a web-based airline assistant: passengers open the chat, send requests to the FastAPI backend, and receive answers or booking details and a ticket. Backend triage delegates questions to FAQ or seat-booking agents; booking updates shared passenger context, then the API saves confirmed bookings and serves ticket PDFs. The README documents MongoDB and LLM-provider configuration. Frontend chat-to-API details and some backend implementation are not shown, so those connections are limited to documented relationships.

Main entry points: [`air-backend/main.py`](https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/main.py) (FastAPI routes), [`air-backend/airline_agents/triage_agent.py`](https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/airline_agents/triage_agent.py) (Triage agent), [`air-backend/airline_agents/faq_agent.py`](https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/airline_agents/faq_agent.py) (FAQ agent), [`air-backend/airline_agents/seat_booking_agent.py`](https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/airline_agents/seat_booking_agent.py) (Seat booking agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Chat frontend"]
  node_landing["Chat entry<br/>[page.tsx]"]
  node_chat["Chat interface<br/>[ChatInterface.tsx]"]
end

subgraph group_api["API and conversation"]
  node_api["FastAPI routes<br/>[main.py]"]
  node_conversation["Conversation processing<br/>[main.py]"]
end

subgraph group_agents["Assistant agents"]
  node_triage["Triage agent<br/>[triage_agent.py]"]
  node_faq["FAQ agent<br/>[faq_agent.py]"]
  node_faq_lookup["FAQ lookup<br/>[faq_tools.py]"]
  node_seat_agent["Seat booking agent"]
end

subgraph group_booking["Booking and tickets"]
  node_booking_tool["Seat update tool<br/>[booking_tools.py]"]
  node_ticket["Ticket generation<br/>[booking_tools.py]"]
end

subgraph group_state["Passenger state"]
  node_context["Passenger context<br/>[context.py]"]
  node_mongo[("MongoDB")]
end

node_passenger(("Passenger"))
node_llm{{"Gemini API"}}

node_passenger -->|"opens"| node_landing
node_landing -->|"renders"| node_chat
node_passenger -.->|"sends requests"| node_chat
node_chat -.->|"calls backend"| node_api
node_api -->|"processes messages"| node_conversation
node_conversation -->|"runs agent"| node_triage
node_triage -->|"hands off"| node_faq
node_triage -->|"hands off"| node_seat_agent
node_faq -->|"returns control"| node_triage
node_seat_agent -->|"returns control"| node_triage
node_faq -->|"calls lookup"| node_faq_lookup
node_seat_agent -->|"calls tool"| node_booking_tool
node_booking_tool -->|"updates"| node_context
node_conversation -->|"uses"| node_context
node_api -->|"saves bookings"| node_mongo
node_api -->|"generates ticket"| node_booking_tool
node_api -->|"serves PDF"| node_ticket
node_ticket -->|"renders details"| node_context
node_api -->|"reads bookings"| node_mongo
node_faq -.->|"queries model"| node_llm
node_seat_agent -.->|"queries model"| node_llm
node_triage -.->|"queries model"| node_llm

click node_landing "https://github.com/ahmedsheikh27/air-travel-agent/blob/main/airline-chatbot-frontend/app/page.tsx"
click node_chat "https://github.com/ahmedsheikh27/air-travel-agent/blob/main/airline-chatbot-frontend/components/ChatInterface.tsx"
click node_api "https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/main.py"
click node_conversation "https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/main.py"
click node_triage "https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/airline_agents/triage_agent.py"
click node_faq "https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/airline_agents/faq_agent.py"
click node_faq_lookup "https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/tools/faq_tools.py"
click node_seat_agent "https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/airline_agents/seat_booking_agent.py"
click node_booking_tool "https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/tools/booking_tools.py"
click node_ticket "https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/tools/booking_tools.py"
click node_context "https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/models/context.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_landing,node_chat toneBlue
class node_api,node_conversation toneAmber
class node_triage,node_faq,node_faq_lookup,node_seat_agent,node_llm toneMint
class node_booking_tool,node_ticket toneRose
class node_context,node_mongo,node_passenger toneIndigo
```

## Components

### Chat frontend

- [Chat entry](https://github.com/ahmedsheikh27/air-travel-agent/blob/main/airline-chatbot-frontend/app/page.tsx): `airline-chatbot-frontend/app/page.tsx`
- [Chat interface](https://github.com/ahmedsheikh27/air-travel-agent/blob/main/airline-chatbot-frontend/components/ChatInterface.tsx): `airline-chatbot-frontend/components/ChatInterface.tsx`

### API and conversation

- [FastAPI routes](https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/main.py): `air-backend/main.py`
- [Conversation processing](https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/main.py): `air-backend/main.py`

### Assistant agents

- [Triage agent](https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/airline_agents/triage_agent.py): `air-backend/airline_agents/triage_agent.py`
- [FAQ agent](https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/airline_agents/faq_agent.py): `air-backend/airline_agents/faq_agent.py`
- [FAQ lookup](https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/tools/faq_tools.py): `air-backend/tools/faq_tools.py`
- [Seat booking agent](https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/airline_agents/seat_booking_agent.py): `air-backend/airline_agents/seat_booking_agent.py`

### Booking and tickets

- [Seat update tool](https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/tools/booking_tools.py): `air-backend/tools/booking_tools.py`
- [Ticket generation](https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/tools/booking_tools.py): `air-backend/tools/booking_tools.py`

### Passenger state

- [Passenger context](https://github.com/ahmedsheikh27/air-travel-agent/blob/main/air-backend/models/context.py): `air-backend/models/context.py`
- **MongoDB**

### Other components

- **Passenger**
- **Gemini API**

## Connections

- Passenger → Chat entry: opens (evidence: `airline-chatbot-frontend/app/page.tsx`)
- Chat entry → Chat interface: renders (evidence: `airline-chatbot-frontend/app/page.tsx`)
- Passenger → Chat interface: sends requests
- Chat interface → FastAPI routes: calls backend (evidence: `README.md`)
- FastAPI routes → Conversation processing: processes messages (evidence: `air-backend/main.py`)
- Conversation processing → Triage agent: runs agent (evidence: `air-backend/main.py`)
- Triage agent → FAQ agent: hands off (evidence: `air-backend/airline_agents/triage_agent.py`)
- Triage agent → Seat booking agent: hands off (evidence: `air-backend/airline_agents/triage_agent.py`)
- FAQ agent → Triage agent: returns control (evidence: `air-backend/airline_agents/triage_agent.py`)
- Seat booking agent → Triage agent: returns control (evidence: `air-backend/airline_agents/triage_agent.py`)
- FAQ agent → FAQ lookup: calls lookup (evidence: `air-backend/airline_agents/faq_agent.py`)
- Seat booking agent → Seat update tool: calls tool (evidence: `air-backend/airline_agents/seat_booking_agent.py`)
- Seat update tool → Passenger context: updates (evidence: `air-backend/tools/booking_tools.py`)
- Conversation processing → Passenger context: uses (evidence: `air-backend/main.py`)
- FastAPI routes → MongoDB: saves bookings (evidence: `air-backend/main.py`)
- FastAPI routes → Seat update tool: generates ticket (evidence: `air-backend/main.py`)
- FastAPI routes → Ticket generation: serves PDF (evidence: `air-backend/main.py`)
- Ticket generation → Passenger context: renders details (evidence: `air-backend/tools/booking_tools.py`)
- FastAPI routes → MongoDB: reads bookings (evidence: `air-backend/main.py`)
- FAQ agent → Gemini API: queries model
- Seat booking agent → Gemini API: queries model
- Triage agent → Gemini API: queries model
