# faiyazazam/agentic-travel-planner architecture

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

- Interactive diagram: https://gitdiagram.com/faiyazazam/agentic-travel-planner
- Repository: https://github.com/faiyazazam/agentic-travel-planner

## Overview

1. **Overall shape**
   - This is a Python travel-planning system built around two paths: an **offline content/indexing path** and an **online planning path**.
   - The runtime user experience is a **Streamlit app** that calls an **agentic planner** backed by a **local FAISS vector store** and city/domain markdown content.

2. **User-facing boundary**
   - `planner_app.py` is the presentation layer.
   - It gathers user inputs such as destination, dates, interests, and budget, then hands those inputs to the planning logic.
   - The app is the only obvious UI boundary; everything else is backend logic or data.

3. **Core orchestration layer**
   - `travel_agent_task.py` is the main orchestration module.
   - It likely coordinates the LLM/agent workflow, decides what information to retrieve, and assembles the final itinerary or travel report.
   - This is the main “brain” of the system and the point where retrieval, prompt construction, and response generation meet.

4. **Retrieval layer and knowledge base**
   - The project uses **RAG** with a local **FAISS index** stored under `data/faiss_index/`.
   - The corpus being embedded comes from `data/rag_docs/` plus the city-specific folders like `Bangkok/`, `Milan/`, `New York/`, `Paris/`, `Prague/`, `Rome/`, and `Tokyo/`.
   - These files act as the grounded knowledge source for itinerary generation and travel guidance.

5. **Indexing / ingestion pipeline**
   - `build_vector_store.py` builds the FAISS store from the local markdown content.
   - `sample_db_creation.py` appears to initialize or populate a sample RAG dataset, likely for demos or first-time setup.
   - This preprocessing step is separate from runtime so the app can work with a local, prebuilt retrieval index.

6. **Content organization**
   - The `data/rag_docs/` folder contains reusable travel knowledge such as cuisine guidance, safety tips, itinerary templates, and top destinations.
   - The city folders contain city-specific reports, guides, and travel plans that function as localized reference material and/or sample outputs.
   - This makes the knowledge base hierarchical: **general travel guidance + destination-specific documents**.

7. **Formatting and plan composition**
   - `travel_plan_utils.py` likely handles structure, formatting, and normalization of the generated itinerary.
   - This is where raw agent output is turned into a readable travel plan or report with consistent sections.
   - It acts as the post-processing boundary between generation and final presentation.

8. **Data flow at runtime**
   - User input enters the Streamlit app.
   - The app passes the request to the agent layer.
   - The agent retrieves relevant context from the FAISS index.
   - Retrieved context plus user preferences are sent to the LLM/agent backend.
   - The response is formatted into the final travel plan and returned to the UI.

9. **External dependency boundary**
   - The repo suggests an external model/API integration configured through `.env` for credentials and environment settings.
   - The retrieval system is local, but text generation depends on an external LLM service or model runtime.
   - That split is important architecturally: **local knowledge + external reasoning/generation**.

10. **Persistence and artifacts**
   - `data/faiss_index/index.faiss` and `index.pkl` are persistent runtime artifacts that make retrieval fast and repeatable.
   - The generated markdown files in the city folders also serve as durable outputs or source material.
   - This means the system is not purely ephemeral; it has a stored knowledge and output layer.

11. **Operational model**
   - The application is designed to work largely offline for retrieval, with a local corpus and vector index.
   - The main online dependency is the model call, not the search/index layer.
   - That makes the architecture suitable for low-latency, repeatable planning workflows.

12. **Architecture summary for a diagram**
   - Draw four main blocks: **Streamlit UI**, **Agent/Planner Core**, **FAISS Retrieval + Local Docs**, and **LLM/API Backend**.
   - Surround them with two supporting blocks: **Indexing/Build Scripts** and **Stored Travel Content/Artifacts**.
   - The key flow is: **user request → agent orchestration → retrieval from local corpus → generation via model → formatted travel plan output**.

Main entry points: [`travel_agent_task.py`](https://github.com/faiyazazam/agentic-travel-planner/blob/main/travel_agent_task.py) (Travel Agent), [`build_vector_store.py`](https://github.com/faiyazazam/agentic-travel-planner/blob/main/build_vector_store.py) (Build Index), [`data/rag_docs`](https://github.com/faiyazazam/agentic-travel-planner/tree/main/data/rag_docs) (General Docs), [`data/faiss_index`](https://github.com/faiyazazam/agentic-travel-planner/tree/main/data/faiss_index) (FAISS Index)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User Interface"]
  node_planner_app["Planner App<br/>streamlit UI<br/>[planner_app.py]"]
end

subgraph group_core["Planning Core"]
  node_travel_agent_task["Travel Agent<br/>orchestrator"]
  node_travel_plan_utils["Plan Utils<br/>formatter"]
end

subgraph group_knowledge["Knowledge Base"]
  node_rag_docs["General Docs<br/>travel corpus"]
  node_faiss_index[("FAISS Index<br/>vector store")]
  node_city_corpus["City Content<br/>destination corpus"]
  node_bangkok["Bangkok<br/>city docs"]
  node_milan["Milan<br/>city docs"]
  node_newyork["New York<br/>city docs"]
  node_paris["Paris<br/>city docs"]
  node_prague["Prague<br/>city docs"]
  node_rome["Rome<br/>city docs"]
  node_tokyo["Tokyo<br/>city docs"]
end

subgraph group_ingest["Indexing Pipeline"]
  node_build_vector_store["Build Index<br/>ingestion"]
  node_sample_db_creation["Sample Data<br/>seed/setup"]
end

subgraph group_external["External Services"]
  node_llm_backend(("LLM Backend<br/>model/api"))
end

node_planner_app -->|"user request"| node_travel_agent_task
node_travel_agent_task -->|"retrieve"| node_faiss_index
node_travel_agent_task -->|"grounding"| node_rag_docs
node_travel_agent_task -->|"destination context"| node_city_corpus
node_travel_agent_task -->|"generate"| node_llm_backend
node_travel_agent_task -->|"format"| node_travel_plan_utils
node_build_vector_store -->|"ingest"| node_rag_docs
node_build_vector_store -->|"ingest"| node_city_corpus
node_build_vector_store -->|"persist"| node_faiss_index
node_sample_db_creation -->|"seed"| node_rag_docs
node_sample_db_creation -->|"initialize"| node_faiss_index
node_city_corpus -->|"includes"| node_bangkok
node_city_corpus -->|"includes"| node_milan
node_city_corpus -->|"includes"| node_newyork
node_city_corpus -->|"includes"| node_paris
node_city_corpus -->|"includes"| node_prague
node_city_corpus -->|"includes"| node_rome
node_city_corpus -->|"includes"| node_tokyo

click node_planner_app "https://github.com/faiyazazam/agentic-travel-planner/blob/main/planner_app.py"
click node_travel_agent_task "https://github.com/faiyazazam/agentic-travel-planner/blob/main/travel_agent_task.py"
click node_travel_plan_utils "https://github.com/faiyazazam/agentic-travel-planner/blob/main/travel_plan_utils.py"
click node_build_vector_store "https://github.com/faiyazazam/agentic-travel-planner/blob/main/build_vector_store.py"
click node_sample_db_creation "https://github.com/faiyazazam/agentic-travel-planner/blob/main/sample_db_creation.py"
click node_rag_docs "https://github.com/faiyazazam/agentic-travel-planner/tree/main/data/rag_docs"
click node_faiss_index "https://github.com/faiyazazam/agentic-travel-planner/tree/main/data/faiss_index"
click node_bangkok "https://github.com/faiyazazam/agentic-travel-planner/tree/main/Bangkok"
click node_milan "https://github.com/faiyazazam/agentic-travel-planner/tree/main/Milan"
click node_newyork "https://github.com/faiyazazam/agentic-travel-planner/tree/main/New York"
click node_paris "https://github.com/faiyazazam/agentic-travel-planner/tree/main/Paris"
click node_prague "https://github.com/faiyazazam/agentic-travel-planner/tree/main/Prague"
click node_rome "https://github.com/faiyazazam/agentic-travel-planner/tree/main/Rome"
click node_tokyo "https://github.com/faiyazazam/agentic-travel-planner/tree/main/Tokyo"

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_planner_app toneBlue
class node_travel_agent_task,node_travel_plan_utils toneAmber
class node_rag_docs,node_faiss_index,node_city_corpus,node_bangkok,node_milan,node_newyork,node_paris,node_prague,node_rome,node_tokyo toneMint
class node_build_vector_store,node_sample_db_creation toneRose
class node_llm_backend toneIndigo
```

## Components

### User Interface

Streamlit entrypoint for trip planning.

- [Planner App](https://github.com/faiyazazam/agentic-travel-planner/blob/main/planner_app.py): streamlit UI · Collects trip preferences and starts the planning flow. · `planner_app.py`

### Planning Core

Agent orchestration and output shaping.

- [Travel Agent](https://github.com/faiyazazam/agentic-travel-planner/blob/main/travel_agent_task.py): orchestrator · Coordinates retrieval, prompting, and itinerary generation. · `travel_agent_task.py`
- [Plan Utils](https://github.com/faiyazazam/agentic-travel-planner/blob/main/travel_plan_utils.py): formatter · Normalizes and formats raw agent output into a readable plan. · `travel_plan_utils.py`

### Knowledge Base

Local documents and vector index used for retrieval.

- [General Docs](https://github.com/faiyazazam/agentic-travel-planner/tree/main/data/rag_docs): travel corpus · Reusable travel guidance such as cuisine, safety, and itinerary templates. · `data/rag_docs`
- [FAISS Index](https://github.com/faiyazazam/agentic-travel-planner/tree/main/data/faiss_index): vector store · Persistent local retrieval index for similarity search. · `data/faiss_index`
- **City Content**: destination corpus · City-specific guides, reports, and travel plans across destination folders.
- [Bangkok](https://github.com/faiyazazam/agentic-travel-planner/tree/main/Bangkok): city docs · Bangkok guide, report, and travel plan artifacts. · `Bangkok`
- [Milan](https://github.com/faiyazazam/agentic-travel-planner/tree/main/Milan): city docs · Milan guide, report, and travel plan artifacts. · `Milan`
- [New York](https://github.com/faiyazazam/agentic-travel-planner/tree/HEAD/New%20York): city docs · New York guide, report, and travel plan artifacts. · `New York`
- [Paris](https://github.com/faiyazazam/agentic-travel-planner/tree/main/Paris): city docs · Paris guide, report, and travel plan artifacts. · `Paris`
- [Prague](https://github.com/faiyazazam/agentic-travel-planner/tree/main/Prague): city docs · Prague guide, report, and travel plan artifacts. · `Prague`
- [Rome](https://github.com/faiyazazam/agentic-travel-planner/tree/main/Rome): city docs · Rome guide, report, and travel plan artifacts. · `Rome`
- [Tokyo](https://github.com/faiyazazam/agentic-travel-planner/tree/main/Tokyo): city docs · Tokyo guide, report, and travel plan artifacts. · `Tokyo`

### Indexing Pipeline

Offline build and sample data preparation.

- [Build Index](https://github.com/faiyazazam/agentic-travel-planner/blob/main/build_vector_store.py): ingestion · Builds the FAISS store from local travel content. · `build_vector_store.py`
- [Sample Data](https://github.com/faiyazazam/agentic-travel-planner/blob/main/sample_db_creation.py): seed/setup · Populates or initializes demo RAG content and index data. · `sample_db_creation.py`

### External Services

Model or API dependency used for generation.

- **LLM Backend**: model/api · External generation service or model runtime used by the agent.

## Connections

- Planner App → Travel Agent: user request · Trip preferences flow from the UI into the planner core.
- Travel Agent → FAISS Index: retrieve · Agent queries the local vector store for relevant context.
- Travel Agent → General Docs: grounding · Agent uses reusable travel guidance as shared context.
- Travel Agent → City Content: destination context · Agent pulls destination-specific material for the chosen city.
- Travel Agent → LLM Backend: generate · Agent sends prompts and retrieved context to the model backend.
- Travel Agent → Plan Utils: format · Generated content is normalized into the final travel plan.
- Build Index → General Docs: ingest · General travel docs are embedded into the index build.
- Build Index → City Content: ingest · City folders contribute destination-specific content to the index.
- Build Index → FAISS Index: persist · The indexing pipeline writes the reusable FAISS artifacts.
- Sample Data → General Docs: seed · Sample setup draws from reusable travel documents.
- Sample Data → FAISS Index: initialize · Sample setup can populate or refresh the local index artifacts.
- City Content → Bangkok: includes · Destination corpus includes Bangkok artifacts.
- City Content → Milan: includes · Destination corpus includes Milan artifacts.
- City Content → New York: includes · Destination corpus includes New York artifacts.
- City Content → Paris: includes · Destination corpus includes Paris artifacts.
- City Content → Prague: includes · Destination corpus includes Prague artifacts.
- City Content → Rome: includes · Destination corpus includes Rome artifacts.
- City Content → Tokyo: includes · Destination corpus includes Tokyo artifacts.
