# shubham96001/bharatyatraai architecture

> Architecture diagram of the GitHub repository shubham96001/bharatyatraai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shubham96001/bharatyatraai
- Repository: https://github.com/shubham96001/bharatyatraai

## Overview

Bharat Yatra AI is a Streamlit travel-planning app. Users enter a trip request, the LangGraph workflow researches transport and hotels, builds an itinerary, and produces a final plan; the UI also offers destination browsing and PDF export. Destination detail pages can prefill the planner, and destination images are resolved from local assets. The graph follows the agent sequence and imports shown in the excerpts and documented UI flow. The flight-search tool is present but no connection from the planner is shown, so it is represented as a separate integration.

Main entry points: [`frontend.py`](https://github.com/shubham96001/bharatyatraai/blob/main/frontend.py) (Streamlit UI), [`state_detail.py`](https://github.com/shubham96001/bharatyatraai/blob/main/state_detail.py) (Destination detail), [`main.py`](https://github.com/shubham96001/bharatyatraai/blob/main/main.py) (LangGraph planner), [`utils/prefill_utils.py`](https://github.com/shubham96001/bharatyatraai/blob/main/utils/prefill_utils.py) (Prompt prefill)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User experience"]
  node_streamlit["Streamlit UI<br/>[frontend.py]"]
  node_pdf["PDF export<br/>[frontend.py]"]
  node_detail["Destination detail<br/>[state_detail.py]"]
  node_prefill["Prompt prefill<br/>[prefill_utils.py]"]
end

subgraph group_planning["Trip planning workflow"]
  node_planner["LangGraph planner<br/>[main.py]"]
  node_transit["Transit agent<br/>[main.py]"]
  node_hotel["Hotel agent<br/>[main.py]"]
  node_itinerary["Itinerary agent<br/>[main.py]"]
  node_final["Final response agent<br/>[main.py]"]
  node_checkpoint[("Conversation checkpoint<br/>[main.py]")]
end

subgraph group_research["Research integrations"]
  node_tavily["Tavily research<br/>[tavily_tool.py]"]
  node_groq{{"Groq LLM"}}
  node_flight_tool["Flight search tool<br/>[flight_tool.py]"]
  node_aviation{{"AviationStack API"}}
end

subgraph group_destinations["Destination content"]
  node_destination_data["Destination metadata<br/>[states_data.py]"]
  node_images["Local image resolver<br/>[image_utils.py]"]
end

node_traveler(("Traveler"))

node_traveler -->|"submits request"| node_streamlit
node_streamlit -->|"invokes planner"| node_planner
node_planner -->|"starts workflow"| node_transit
node_transit -->|"dispatches next"| node_hotel
node_hotel -->|"dispatches next"| node_itinerary
node_itinerary -->|"dispatches next"| node_final
node_transit -->|"searches routes"| node_tavily
node_hotel -->|"searches hotels"| node_tavily
node_itinerary -->|"generates itinerary"| node_groq
node_final -->|"summarizes plan"| node_groq
node_planner -->|"persists state"| node_checkpoint
node_final -->|"streams results"| node_streamlit
node_streamlit -->|"exports plan"| node_pdf
node_streamlit -->|"renders selection"| node_detail
node_detail -->|"reads details"| node_destination_data
node_detail -->|"builds prompt"| node_prefill
node_prefill -->|"fills planner"| node_streamlit
node_detail -->|"resolves gallery"| node_images
node_streamlit -->|"looks up imagery"| node_destination_data
node_streamlit -->|"resolves images"| node_images
node_flight_tool -->|"requests flights"| node_aviation

click node_streamlit "https://github.com/shubham96001/bharatyatraai/blob/main/frontend.py"
click node_pdf "https://github.com/shubham96001/bharatyatraai/blob/main/frontend.py"
click node_detail "https://github.com/shubham96001/bharatyatraai/blob/main/state_detail.py"
click node_prefill "https://github.com/shubham96001/bharatyatraai/blob/main/utils/prefill_utils.py"
click node_planner "https://github.com/shubham96001/bharatyatraai/blob/main/main.py"
click node_transit "https://github.com/shubham96001/bharatyatraai/blob/main/main.py"
click node_hotel "https://github.com/shubham96001/bharatyatraai/blob/main/main.py"
click node_itinerary "https://github.com/shubham96001/bharatyatraai/blob/main/main.py"
click node_final "https://github.com/shubham96001/bharatyatraai/blob/main/main.py"
click node_tavily "https://github.com/shubham96001/bharatyatraai/blob/main/tools/tavily_tool.py"
click node_checkpoint "https://github.com/shubham96001/bharatyatraai/blob/main/main.py"
click node_destination_data "https://github.com/shubham96001/bharatyatraai/blob/main/states_data.py"
click node_images "https://github.com/shubham96001/bharatyatraai/blob/main/image_utils.py"
click node_flight_tool "https://github.com/shubham96001/bharatyatraai/blob/main/tools/flight_tool.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_streamlit,node_pdf,node_detail,node_prefill toneBlue
class node_planner,node_transit,node_hotel,node_itinerary,node_final,node_checkpoint toneAmber
class node_tavily,node_groq,node_flight_tool,node_aviation toneMint
class node_destination_data,node_images toneRose
class node_traveler toneIndigo
```

## Components

### User experience

- [Streamlit UI](https://github.com/shubham96001/bharatyatraai/blob/main/frontend.py): `frontend.py`
- [PDF export](https://github.com/shubham96001/bharatyatraai/blob/main/frontend.py): `frontend.py`
- [Destination detail](https://github.com/shubham96001/bharatyatraai/blob/main/state_detail.py): `state_detail.py`
- [Prompt prefill](https://github.com/shubham96001/bharatyatraai/blob/main/utils/prefill_utils.py): `utils/prefill_utils.py`

### Trip planning workflow

- [LangGraph planner](https://github.com/shubham96001/bharatyatraai/blob/main/main.py): `main.py`
- [Transit agent](https://github.com/shubham96001/bharatyatraai/blob/main/main.py): `main.py`
- [Hotel agent](https://github.com/shubham96001/bharatyatraai/blob/main/main.py): `main.py`
- [Itinerary agent](https://github.com/shubham96001/bharatyatraai/blob/main/main.py): `main.py`
- [Final response agent](https://github.com/shubham96001/bharatyatraai/blob/main/main.py): `main.py`
- [Conversation checkpoint](https://github.com/shubham96001/bharatyatraai/blob/main/main.py): `main.py`

### Research integrations

- [Tavily research](https://github.com/shubham96001/bharatyatraai/blob/main/tools/tavily_tool.py): `tools/tavily_tool.py`
- **Groq LLM**
- [Flight search tool](https://github.com/shubham96001/bharatyatraai/blob/main/tools/flight_tool.py): `tools/flight_tool.py`
- **AviationStack API**

### Destination content

- [Destination metadata](https://github.com/shubham96001/bharatyatraai/blob/main/states_data.py): `states_data.py`
- [Local image resolver](https://github.com/shubham96001/bharatyatraai/blob/main/image_utils.py): `image_utils.py`

### Other components

- **Traveler**

## Connections

- Traveler → Streamlit UI: submits request (evidence: `README.md`)
- Streamlit UI → LangGraph planner: invokes planner (evidence: `README.md`)
- LangGraph planner → Transit agent: starts workflow (evidence: `main.py`)
- Transit agent → Hotel agent: dispatches next (evidence: `main.py`)
- Hotel agent → Itinerary agent: dispatches next (evidence: `main.py`)
- Itinerary agent → Final response agent: dispatches next (evidence: `main.py`)
- Transit agent → Tavily research: searches routes (evidence: `main.py`)
- Hotel agent → Tavily research: searches hotels (evidence: `main.py`)
- Itinerary agent → Groq LLM: generates itinerary (evidence: `main.py`)
- Final response agent → Groq LLM: summarizes plan (evidence: `main.py`)
- LangGraph planner → Conversation checkpoint: persists state (evidence: `main.py`)
- Final response agent → Streamlit UI: streams results (evidence: `README.md`)
- Streamlit UI → PDF export: exports plan (evidence: `README.md`)
- Streamlit UI → Destination detail: renders selection (evidence: `frontend.py`)
- Destination detail → Destination metadata: reads details (evidence: `state_detail.py`)
- Destination detail → Prompt prefill: builds prompt (evidence: `state_detail.py`)
- Prompt prefill → Streamlit UI: fills planner
- Destination detail → Local image resolver: resolves gallery (evidence: `state_detail.py`)
- Streamlit UI → Destination metadata: looks up imagery (evidence: `frontend.py`)
- Streamlit UI → Local image resolver: resolves images (evidence: `frontend.py`)
- Flight search tool → AviationStack API: requests flights (evidence: `tools/flight_tool.py`)
