# krishgarg344/autonomous-travel-planner architecture

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

- Interactive diagram: https://gitdiagram.com/krishgarg344/autonomous-travel-planner
- Repository: https://github.com/krishgarg344/autonomous-travel-planner

## Overview

Autonomous Travel Planner accepts trip details through a Streamlit chat UI or API, maintains per-session trip and conversation state, and uses a Groq tool-calling agent to gather flight, weather, and place information. When the trip has the required details, the agent sends its draft to Gemini for structured itinerary output. The graph preserves the documented tool capabilities; source excerpts show the API/UI and tool implementations, but not every agent dispatch detail.

Main entry points: [`agent.py`](https://github.com/krishgarg344/autonomous-travel-planner/blob/main/agent.py) (Tool-calling agent), [`main.py`](https://github.com/krishgarg344/autonomous-travel-planner/blob/main/main.py) (Trip API), [`streamlitUI.py`](https://github.com/krishgarg344/autonomous-travel-planner/blob/main/streamlitUI.py) (Chat UI), [`tools/get_places.py`](https://github.com/krishgarg344/autonomous-travel-planner/blob/main/tools/get_places.py) (Places search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User interface"]
  node_streamlit["Chat UI<br/>[streamlitUI.py]"]
  node_api["Trip API<br/>[main.py]"]
end

subgraph group_orchestration["Trip orchestration"]
  node_trip_state["Trip state<br/>[agent.py]"]
  node_chat_memory[("Chat memory<br/>[agent.py]")]
  node_travel_agent["Tool-calling agent<br/>[agent.py]"]
  node_config["API configuration<br/>[config.py]"]
end

subgraph group_research["Travel research"]
  node_weather_tool["Weather lookup<br/>[get_weather.py]"]
  node_places_tool["Places search<br/>[get_places.py]"]
  node_flights_tool["Flight search<br/>[get_flights.py]"]
end

subgraph group_models["Trip data"]
  node_trip_request["Trip request<br/>[request.py]"]
  node_itinerary["Structured itinerary<br/>[itinerary.py]"]
end

node_traveler(("Traveler"))
node_weather_service["Open-Meteo"]
node_places_service["Google Places"]
node_flight_service["AeroDataBox"]
node_groq["Groq model"]
node_gemini["Gemini model"]

node_traveler -->|"enters trip"| node_streamlit
node_streamlit -->|"posts chat"| node_api
node_api -->|"validates trip"| node_trip_request
node_api -->|"calls handler"| node_travel_agent
node_api -->|"formats response"| node_itinerary
node_travel_agent -->|"updates state"| node_trip_state
node_travel_agent -->|"trims history"| node_chat_memory
node_travel_agent -->|"invokes agent"| node_groq
node_travel_agent -->|"dispatches tool"| node_weather_tool
node_travel_agent -->|"dispatches tool"| node_places_tool
node_travel_agent -->|"dispatches tool"| node_flights_tool
node_travel_agent -->|"formats draft"| node_gemini
node_travel_agent -->|"requests structure"| node_itinerary
node_flights_tool -->|"reads API key"| node_config
node_places_tool -->|"reads API key"| node_config
node_weather_tool -->|"fetches forecast"| node_weather_service
node_places_tool -->|"searches places"| node_places_service
node_flights_tool -->|"searches flights"| node_flight_service
node_streamlit -->|"renders itinerary"| node_itinerary

click node_streamlit "https://github.com/krishgarg344/autonomous-travel-planner/blob/main/streamlitUI.py"
click node_api "https://github.com/krishgarg344/autonomous-travel-planner/blob/main/main.py"
click node_trip_request "https://github.com/krishgarg344/autonomous-travel-planner/blob/main/schemas/request.py"
click node_trip_state "https://github.com/krishgarg344/autonomous-travel-planner/blob/main/agent.py"
click node_chat_memory "https://github.com/krishgarg344/autonomous-travel-planner/blob/main/agent.py"
click node_travel_agent "https://github.com/krishgarg344/autonomous-travel-planner/blob/main/agent.py"
click node_config "https://github.com/krishgarg344/autonomous-travel-planner/blob/main/config.py"
click node_weather_tool "https://github.com/krishgarg344/autonomous-travel-planner/blob/main/tools/get_weather.py"
click node_places_tool "https://github.com/krishgarg344/autonomous-travel-planner/blob/main/tools/get_places.py"
click node_flights_tool "https://github.com/krishgarg344/autonomous-travel-planner/blob/main/tools/get_flights.py"
click node_itinerary "https://github.com/krishgarg344/autonomous-travel-planner/blob/main/schemas/itinerary.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_api toneBlue
class node_trip_state,node_chat_memory,node_travel_agent,node_config toneAmber
class node_weather_tool,node_places_tool,node_flights_tool toneMint
class node_trip_request,node_itinerary toneRose
class node_traveler,node_weather_service,node_places_service,node_flight_service,node_groq,node_gemini toneIndigo
```

## Components

### User interface

- [Chat UI](https://github.com/krishgarg344/autonomous-travel-planner/blob/main/streamlitUI.py): `streamlitUI.py`
- [Trip API](https://github.com/krishgarg344/autonomous-travel-planner/blob/main/main.py): `main.py`

### Trip orchestration

- [Trip state](https://github.com/krishgarg344/autonomous-travel-planner/blob/main/agent.py): `agent.py`
- [Chat memory](https://github.com/krishgarg344/autonomous-travel-planner/blob/main/agent.py): `agent.py`
- [Tool-calling agent](https://github.com/krishgarg344/autonomous-travel-planner/blob/main/agent.py): `agent.py`
- [API configuration](https://github.com/krishgarg344/autonomous-travel-planner/blob/main/config.py): `config.py`

### Travel research

- [Weather lookup](https://github.com/krishgarg344/autonomous-travel-planner/blob/main/tools/get_weather.py): `tools/get_weather.py`
- [Places search](https://github.com/krishgarg344/autonomous-travel-planner/blob/main/tools/get_places.py): `tools/get_places.py`
- [Flight search](https://github.com/krishgarg344/autonomous-travel-planner/blob/main/tools/get_flights.py): `tools/get_flights.py`

### Trip data

- [Trip request](https://github.com/krishgarg344/autonomous-travel-planner/blob/main/schemas/request.py): `schemas/request.py`
- [Structured itinerary](https://github.com/krishgarg344/autonomous-travel-planner/blob/main/schemas/itinerary.py): `schemas/itinerary.py`

### Other components

- **Traveler**
- **Open-Meteo**
- **Google Places**
- **AeroDataBox**
- **Groq model**
- **Gemini model**

## Connections

- Traveler → Chat UI: enters trip (evidence: `streamlitUI.py`)
- Chat UI → Trip API: posts chat (evidence: `streamlitUI.py`)
- Trip API → Trip request: validates trip (evidence: `main.py`)
- Trip API → Tool-calling agent: calls handler (evidence: `main.py`)
- Trip API → Structured itinerary: formats response (evidence: `main.py`)
- Tool-calling agent → Trip state: updates state (evidence: `agent.py`)
- Tool-calling agent → Chat memory: trims history (evidence: `agent.py`)
- Tool-calling agent → Groq model: invokes agent (evidence: `README.md`)
- Tool-calling agent → Weather lookup: dispatches tool (evidence: `README.md`)
- Tool-calling agent → Places search: dispatches tool (evidence: `README.md`)
- Tool-calling agent → Flight search: dispatches tool (evidence: `README.md`)
- Tool-calling agent → Gemini model: formats draft (evidence: `agent.py`)
- Tool-calling agent → Structured itinerary: requests structure (evidence: `agent.py`)
- Flight search → API configuration: reads API key (evidence: `tools/get_flights.py`)
- Places search → API configuration: reads API key (evidence: `tools/get_places.py`)
- Weather lookup → Open-Meteo: fetches forecast (evidence: `tools/get_weather.py`)
- Places search → Google Places: searches places (evidence: `tools/get_places.py`)
- Flight search → AeroDataBox: searches flights (evidence: `tools/get_flights.py`)
- Chat UI → Structured itinerary: renders itinerary (evidence: `streamlitUI.py`)
