# mdsohail07/tripmateai architecture

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

- Interactive diagram: https://gitdiagram.com/mdsohail07/tripmateai
- Repository: https://github.com/mdsohail07/tripmateai

## Overview

TripMateAI is a Streamlit travel planner: users submit a request, and a LangGraph workflow gathers flight and hotel information, generates an itinerary, and produces a final response. PostgreSQL backs workflow checkpointing; AviationStack and Tavily supply external search data, while Groq generates plan text. The README also lists destination, restaurant, transport, budget, and weather recommendations, but their implementation is not shown in the sampled source, so they are represented as documented capabilities rather than connected runtime stages.

Main entry points: [`main.py`](https://github.com/mdsohail07/tripmateai/blob/main/main.py) (LangGraph App), [`frontend.py`](https://github.com/mdsohail07/tripmateai/blob/main/frontend.py) (Streamlit Interface), [`tools/flight_tool.py`](https://github.com/mdsohail07/tripmateai/blob/main/tools/flight_tool.py) (Flight Search Tool), [`tools/tavily_tool.py`](https://github.com/mdsohail07/tripmateai/blob/main/tools/tavily_tool.py) (Web Search Tool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_streamlit["Streamlit Interface<br/>[frontend.py]"]
end

subgraph group_workflow["Planning Workflow"]
  node_workflow_app["LangGraph App<br/>[main.py]"]
  node_flight_agent["Flight Agent<br/>[main.py]"]
  node_hotel_agent["Hotel Agent<br/>[main.py]"]
  node_itinerary_agent["Itinerary Agent<br/>[main.py]"]
  node_final_agent["Final Agent<br/>[main.py]"]
  node_trip_extras["Other Trip Recommendations"]
end

subgraph group_integrations["Search Integrations"]
  node_flight_search["Flight Search Tool<br/>[flight_tool.py]"]
  node_hotel_search["Web Search Tool<br/>[tavily_tool.py]"]
end

subgraph group_services["Persistence and AI"]
  node_postgres[("PostgreSQL Checkpoints<br/>[main.py]")]
end

node_traveler(("Traveler"))
node_aviationstack["AviationStack API"]
node_tavily["Tavily Search API"]
node_groq["Groq LLM"]

node_traveler -->|"submits request"| node_streamlit
node_streamlit -->|"uses app"| node_workflow_app
node_workflow_app -->|"starts workflow"| node_flight_agent
node_flight_agent -->|"dispatches next"| node_hotel_agent
node_hotel_agent -->|"dispatches next"| node_itinerary_agent
node_itinerary_agent -->|"dispatches next"| node_final_agent
node_flight_agent -->|"searches flights"| node_flight_search
node_flight_search -->|"requests flight data"| node_aviationstack
node_hotel_agent -->|"searches hotels"| node_hotel_search
node_hotel_search -->|"searches web"| node_tavily
node_itinerary_agent -->|"generates itinerary"| node_groq
node_final_agent -->|"generates response"| node_groq
node_workflow_app -->|"stores checkpoints"| node_postgres

click node_streamlit "https://github.com/mdsohail07/tripmateai/blob/main/frontend.py"
click node_workflow_app "https://github.com/mdsohail07/tripmateai/blob/main/main.py"
click node_flight_agent "https://github.com/mdsohail07/tripmateai/blob/main/main.py"
click node_hotel_agent "https://github.com/mdsohail07/tripmateai/blob/main/main.py"
click node_itinerary_agent "https://github.com/mdsohail07/tripmateai/blob/main/main.py"
click node_final_agent "https://github.com/mdsohail07/tripmateai/blob/main/main.py"
click node_flight_search "https://github.com/mdsohail07/tripmateai/blob/main/tools/flight_tool.py"
click node_hotel_search "https://github.com/mdsohail07/tripmateai/blob/main/tools/tavily_tool.py"
click node_postgres "https://github.com/mdsohail07/tripmateai/blob/main/main.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 toneBlue
class node_workflow_app,node_flight_agent,node_hotel_agent,node_itinerary_agent,node_final_agent,node_trip_extras toneAmber
class node_flight_search,node_hotel_search,node_aviationstack,node_tavily toneMint
class node_postgres toneRose
class node_traveler,node_groq toneIndigo
```

## Components

### User Interface

- [Streamlit Interface](https://github.com/mdsohail07/tripmateai/blob/main/frontend.py): `frontend.py`

### Planning Workflow

- [LangGraph App](https://github.com/mdsohail07/tripmateai/blob/main/main.py): `main.py`
- [Flight Agent](https://github.com/mdsohail07/tripmateai/blob/main/main.py): `main.py`
- [Hotel Agent](https://github.com/mdsohail07/tripmateai/blob/main/main.py): `main.py`
- [Itinerary Agent](https://github.com/mdsohail07/tripmateai/blob/main/main.py): `main.py`
- [Final Agent](https://github.com/mdsohail07/tripmateai/blob/main/main.py): `main.py`
- **Other Trip Recommendations**

### Search Integrations

- [Flight Search Tool](https://github.com/mdsohail07/tripmateai/blob/main/tools/flight_tool.py): `tools/flight_tool.py`
- [Web Search Tool](https://github.com/mdsohail07/tripmateai/blob/main/tools/tavily_tool.py): `tools/tavily_tool.py`

### Persistence and AI

- [PostgreSQL Checkpoints](https://github.com/mdsohail07/tripmateai/blob/main/main.py): `main.py`

### Other components

- **Traveler**
- **AviationStack API**
- **Tavily Search API**
- **Groq LLM**

## Connections

- Traveler → Streamlit Interface: submits request (evidence: `README.md`)
- Streamlit Interface → LangGraph App: uses app (evidence: `frontend.py`)
- LangGraph App → Flight Agent: starts workflow (evidence: `main.py`)
- Flight Agent → Hotel Agent: dispatches next (evidence: `main.py`)
- Hotel Agent → Itinerary Agent: dispatches next (evidence: `main.py`)
- Itinerary Agent → Final Agent: dispatches next (evidence: `main.py`)
- Flight Agent → Flight Search Tool: searches flights (evidence: `main.py`)
- Flight Search Tool → AviationStack API: requests flight data (evidence: `tools/flight_tool.py`)
- Hotel Agent → Web Search Tool: searches hotels (evidence: `main.py`)
- Web Search Tool → Tavily Search API: searches web (evidence: `tools/tavily_tool.py`)
- Itinerary Agent → Groq LLM: generates itinerary (evidence: `main.py`)
- Final Agent → Groq LLM: generates response (evidence: `main.py`)
- LangGraph App → PostgreSQL Checkpoints: stores checkpoints (evidence: `main.py`)
