# harshbhanushali26/waypoint architecture

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

- Interactive diagram: https://gitdiagram.com/harshbhanushali26/waypoint
- Repository: https://github.com/harshbhanushali26/waypoint

## Overview

Waypoint turns a submitted trip request into a grounded, budget-aware itinerary, then pauses for user approval or edits. The documented workflow runs through normalization, planning, live data searches, budgeting, itinerary composition, validation, and review; edits are interpreted and selectively rerun. The graph captures the documented orchestration and major product capabilities. Several frontend-to-API and unsampled subsystem links are not established by the excerpts, so they are omitted or marked unverified.

Main entry points: [`graph/build_graph.py`](https://github.com/harshbhanushali26/waypoint/blob/main/graph/build_graph.py) (Workflow graph), [`graph/state.py`](https://github.com/harshbhanushali26/waypoint/blob/main/graph/state.py) (Trip state), [`api/routers/trips.py`](https://github.com/harshbhanushali26/waypoint/blob/main/api/routers/trips.py) (Trip endpoints), [`core/llm.py`](https://github.com/harshbhanushali26/waypoint/blob/main/core/llm.py) (Structured LLM runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_trip_form["Trip form<br/>[form.js]"]
  node_trip_views["Trip views"]
  node_review_ui["Review UI<br/>[review.js]"]
  node_calendar_export["Calendar export<br/>[calendar-export.js]"]
end

subgraph group_api["API and persistence"]
  node_api_app["FastAPI app<br/>[main.py]"]
  node_trip_routes["Trip endpoints<br/>[trips.py]"]
  node_trip_store[("Trip records<br/>[models.py]")]
  node_db_sessions["Database sessions<br/>[session.py]"]
  node_checkpoint[("Graph checkpoint<br/>[checkpointer.py]")]
end

subgraph group_workflow["Trip workflow"]
  node_graph_runtime["Workflow graph<br/>[build_graph.py]"]
  node_trip_state["Trip state<br/>[state.py]"]
  node_concierge["Input normalization<br/>[concierge.py]"]
  node_planner["Search planning<br/>[planner.py]"]
  node_budget["Budget analysis<br/>[budget.py]"]
  node_itinerary_builder["Itinerary builder"]
  node_validator["Itinerary validator<br/>[validator.py]"]
  node_human_review["Human review<br/>[human_review.py]"]
  node_critic["Review critic<br/>[critic.py]"]
  node_finalize["Finalize trip<br/>[finalize.py]"]
end

subgraph group_data["Travel data"]
  node_flight_search["Flight search<br/>[search_flights.py]"]
  node_train_search["Train search<br/>[search_trains.py]"]
  node_hotel_search["Hotel search<br/>[search_hotels.py]"]
  node_activity_search["Activity search"]
  node_weather_search["Weather search<br/>[get_weather.py]"]
end

subgraph group_shared["Shared runtime"]
  node_llm_runtime["Structured LLM runtime<br/>[llm.py]"]
  node_schemas["Typed schemas<br/>[schemas.py]"]
end

node_traveler(("Traveler"))
node_travel_apis["Travel data providers"]
node_postgres[("PostgreSQL")]

node_traveler -->|"enters trip"| node_trip_form
node_trip_form -.->|"submits trip"| node_trip_routes
node_api_app -->|"builds graph"| node_graph_runtime
node_api_app -->|"registers routes"| node_trip_routes
node_trip_routes -.->|"manages records"| node_trip_store
node_trip_routes -.->|"invokes workflow"| node_graph_runtime
node_api_app -->|"sets up checkpoint"| node_checkpoint
node_graph_runtime -->|"runs"| node_concierge
node_graph_runtime -->|"runs"| node_planner
node_graph_runtime -->|"dispatches search"| node_flight_search
node_graph_runtime -->|"dispatches search"| node_train_search
node_graph_runtime -->|"dispatches search"| node_hotel_search
node_graph_runtime -->|"dispatches search"| node_activity_search
node_graph_runtime -->|"dispatches search"| node_weather_search
node_graph_runtime -->|"runs"| node_budget
node_graph_runtime -->|"runs"| node_itinerary_builder
node_graph_runtime -->|"runs"| node_validator
node_graph_runtime -->|"pauses for review"| node_human_review
node_graph_runtime -->|"routes edits"| node_critic
node_graph_runtime -->|"finalizes approval"| node_finalize
node_concierge -->|"writes normalized input"| node_trip_state
node_planner -->|"writes search plan"| node_trip_state
node_budget -->|"requests structured output"| node_llm_runtime
node_itinerary_builder -->|"requests structured output"| node_llm_runtime
node_critic -->|"requests structured output"| node_llm_runtime
node_budget -->|"reads trip data"| node_trip_state
node_itinerary_builder -->|"reads candidates"| node_trip_state
node_critic -->|"reads review state"| node_trip_state
node_human_review -->|"pauses and updates"| node_trip_state
node_validator -->|"validates itinerary"| node_trip_state
node_flight_search -->|"fetches flights"| node_travel_apis
node_train_search -->|"fetches train fares"| node_travel_apis
node_hotel_search -->|"fetches hotels"| node_travel_apis
node_activity_search -->|"searches activities"| node_travel_apis
node_weather_search -->|"fetches forecast"| node_travel_apis
node_activity_search -->|"extracts activities"| node_llm_runtime
node_finalize -->|"uses sessions"| node_db_sessions
node_db_sessions -.->|"persists trip data"| node_trip_store
node_checkpoint -->|"stores checkpoints"| node_postgres
node_db_sessions -->|"connects to"| node_postgres
node_trip_routes -.->|"returns itinerary"| node_trip_views
node_trip_routes -.->|"accepts review"| node_review_ui
node_trip_views -.->|"exports schedule"| node_calendar_export
node_schemas -.->|"defines typed outputs"| node_trip_state

click node_trip_form "https://github.com/harshbhanushali26/waypoint/blob/main/frontend/js/form.js"
click node_trip_views "https://github.com/harshbhanushali26/waypoint/blob/main/frontend/js/itinerary-render.js"
click node_review_ui "https://github.com/harshbhanushali26/waypoint/blob/main/frontend/js/review.js"
click node_calendar_export "https://github.com/harshbhanushali26/waypoint/blob/main/frontend/js/calendar-export.js"
click node_api_app "https://github.com/harshbhanushali26/waypoint/blob/main/api/main.py"
click node_trip_routes "https://github.com/harshbhanushali26/waypoint/blob/main/api/routers/trips.py"
click node_trip_store "https://github.com/harshbhanushali26/waypoint/blob/main/db/models.py"
click node_db_sessions "https://github.com/harshbhanushali26/waypoint/blob/main/db/session.py"
click node_checkpoint "https://github.com/harshbhanushali26/waypoint/blob/main/db/checkpointer.py"
click node_graph_runtime "https://github.com/harshbhanushali26/waypoint/blob/main/graph/build_graph.py"
click node_trip_state "https://github.com/harshbhanushali26/waypoint/blob/main/graph/state.py"
click node_concierge "https://github.com/harshbhanushali26/waypoint/blob/main/agents/concierge.py"
click node_planner "https://github.com/harshbhanushali26/waypoint/blob/main/agents/planner.py"
click node_budget "https://github.com/harshbhanushali26/waypoint/blob/main/agents/budget.py"
click node_itinerary_builder "https://github.com/harshbhanushali26/waypoint/blob/main/agents/itinerary_builder.py"
click node_validator "https://github.com/harshbhanushali26/waypoint/blob/main/graph/validator.py"
click node_human_review "https://github.com/harshbhanushali26/waypoint/blob/main/graph/human_review.py"
click node_critic "https://github.com/harshbhanushali26/waypoint/blob/main/agents/critic.py"
click node_finalize "https://github.com/harshbhanushali26/waypoint/blob/main/graph/finalize.py"
click node_flight_search "https://github.com/harshbhanushali26/waypoint/blob/main/tools/search_flights.py"
click node_train_search "https://github.com/harshbhanushali26/waypoint/blob/main/tools/search_trains.py"
click node_hotel_search "https://github.com/harshbhanushali26/waypoint/blob/main/tools/search_hotels.py"
click node_activity_search "https://github.com/harshbhanushali26/waypoint/blob/main/tools/search_activities.py"
click node_weather_search "https://github.com/harshbhanushali26/waypoint/blob/main/tools/get_weather.py"
click node_llm_runtime "https://github.com/harshbhanushali26/waypoint/blob/main/core/llm.py"
click node_schemas "https://github.com/harshbhanushali26/waypoint/blob/main/models/schemas.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_trip_form,node_trip_views,node_review_ui,node_calendar_export toneBlue
class node_api_app,node_trip_routes,node_trip_store,node_db_sessions,node_checkpoint,node_postgres toneAmber
class node_graph_runtime,node_trip_state,node_concierge,node_planner,node_budget,node_itinerary_builder,node_validator,node_human_review,node_critic,node_finalize toneMint
class node_flight_search,node_train_search,node_hotel_search,node_activity_search,node_weather_search toneRose
class node_llm_runtime,node_schemas,node_traveler,node_travel_apis toneIndigo
```

## Components

### User experience

- [Trip form](https://github.com/harshbhanushali26/waypoint/blob/main/frontend/js/form.js): `frontend/js/form.js`
- [Trip views](https://github.com/harshbhanushali26/waypoint/blob/main/frontend/js/itinerary-render.js): `frontend/js/itinerary-render.js`
- [Review UI](https://github.com/harshbhanushali26/waypoint/blob/main/frontend/js/review.js): `frontend/js/review.js`
- [Calendar export](https://github.com/harshbhanushali26/waypoint/blob/main/frontend/js/calendar-export.js): `frontend/js/calendar-export.js`

### API and persistence

- [FastAPI app](https://github.com/harshbhanushali26/waypoint/blob/main/api/main.py): `api/main.py`
- [Trip endpoints](https://github.com/harshbhanushali26/waypoint/blob/main/api/routers/trips.py): `api/routers/trips.py`
- [Trip records](https://github.com/harshbhanushali26/waypoint/blob/main/db/models.py): `db/models.py`
- [Database sessions](https://github.com/harshbhanushali26/waypoint/blob/main/db/session.py): `db/session.py`
- [Graph checkpoint](https://github.com/harshbhanushali26/waypoint/blob/main/db/checkpointer.py): `db/checkpointer.py`

### Trip workflow

- [Workflow graph](https://github.com/harshbhanushali26/waypoint/blob/main/graph/build_graph.py): `graph/build_graph.py`
- [Trip state](https://github.com/harshbhanushali26/waypoint/blob/main/graph/state.py): `graph/state.py`
- [Input normalization](https://github.com/harshbhanushali26/waypoint/blob/main/agents/concierge.py): `agents/concierge.py`
- [Search planning](https://github.com/harshbhanushali26/waypoint/blob/main/agents/planner.py): `agents/planner.py`
- [Budget analysis](https://github.com/harshbhanushali26/waypoint/blob/main/agents/budget.py): `agents/budget.py`
- [Itinerary builder](https://github.com/harshbhanushali26/waypoint/blob/main/agents/itinerary_builder.py): `agents/itinerary_builder.py`
- [Itinerary validator](https://github.com/harshbhanushali26/waypoint/blob/main/graph/validator.py): `graph/validator.py`
- [Human review](https://github.com/harshbhanushali26/waypoint/blob/main/graph/human_review.py): `graph/human_review.py`
- [Review critic](https://github.com/harshbhanushali26/waypoint/blob/main/agents/critic.py): `agents/critic.py`
- [Finalize trip](https://github.com/harshbhanushali26/waypoint/blob/main/graph/finalize.py): `graph/finalize.py`

### Travel data

- [Flight search](https://github.com/harshbhanushali26/waypoint/blob/main/tools/search_flights.py): `tools/search_flights.py`
- [Train search](https://github.com/harshbhanushali26/waypoint/blob/main/tools/search_trains.py): `tools/search_trains.py`
- [Hotel search](https://github.com/harshbhanushali26/waypoint/blob/main/tools/search_hotels.py): `tools/search_hotels.py`
- [Activity search](https://github.com/harshbhanushali26/waypoint/blob/main/tools/search_activities.py): `tools/search_activities.py`
- [Weather search](https://github.com/harshbhanushali26/waypoint/blob/main/tools/get_weather.py): `tools/get_weather.py`

### Shared runtime

- [Structured LLM runtime](https://github.com/harshbhanushali26/waypoint/blob/main/core/llm.py): `core/llm.py`
- [Typed schemas](https://github.com/harshbhanushali26/waypoint/blob/main/models/schemas.py): `models/schemas.py`

### Other components

- **Traveler**
- **Travel data providers**
- **PostgreSQL**

## Connections

- Traveler → Trip form: enters trip
- Trip form → Trip endpoints: submits trip
- FastAPI app → Workflow graph: builds graph (evidence: `api/main.py`)
- FastAPI app → Trip endpoints: registers routes (evidence: `api/main.py`)
- Trip endpoints → Trip records: manages records (evidence: `api/routers/trips.py`)
- Trip endpoints → Workflow graph: invokes workflow
- FastAPI app → Graph checkpoint: sets up checkpoint (evidence: `api/main.py`)
- Workflow graph → Input normalization: runs (evidence: `graph/build_graph.py`)
- Workflow graph → Search planning: runs (evidence: `graph/build_graph.py`)
- Workflow graph → Flight search: dispatches search (evidence: `graph/build_graph.py`)
- Workflow graph → Train search: dispatches search (evidence: `graph/build_graph.py`)
- Workflow graph → Hotel search: dispatches search (evidence: `graph/build_graph.py`)
- Workflow graph → Activity search: dispatches search (evidence: `graph/build_graph.py`)
- Workflow graph → Weather search: dispatches search (evidence: `graph/build_graph.py`)
- Workflow graph → Budget analysis: runs (evidence: `graph/build_graph.py`)
- Workflow graph → Itinerary builder: runs (evidence: `graph/build_graph.py`)
- Workflow graph → Itinerary validator: runs (evidence: `graph/build_graph.py`)
- Workflow graph → Human review: pauses for review (evidence: `graph/build_graph.py`)
- Workflow graph → Review critic: routes edits (evidence: `graph/build_graph.py`)
- Workflow graph → Finalize trip: finalizes approval (evidence: `graph/build_graph.py`)
- Input normalization → Trip state: writes normalized input (evidence: `agents/concierge.py`)
- Search planning → Trip state: writes search plan (evidence: `agents/planner.py`)
- Budget analysis → Structured LLM runtime: requests structured output (evidence: `agents/budget.py`)
- Itinerary builder → Structured LLM runtime: requests structured output (evidence: `agents/itinerary_builder.py`)
- Review critic → Structured LLM runtime: requests structured output (evidence: `agents/critic.py`)
- Budget analysis → Trip state: reads trip data (evidence: `agents/budget.py`)
- Itinerary builder → Trip state: reads candidates (evidence: `agents/itinerary_builder.py`)
- Review critic → Trip state: reads review state (evidence: `agents/critic.py`)
- Human review → Trip state: pauses and updates (evidence: `graph/human_review.py`)
- Itinerary validator → Trip state: validates itinerary (evidence: `graph/validator.py`)
- Flight search → Travel data providers: fetches flights
- Train search → Travel data providers: fetches train fares
- Hotel search → Travel data providers: fetches hotels
- Activity search → Travel data providers: searches activities
- Weather search → Travel data providers: fetches forecast
- Activity search → Structured LLM runtime: extracts activities (evidence: `tools/search_activities.py`)
- Finalize trip → Database sessions: uses sessions (evidence: `graph/finalize.py`)
- Database sessions → Trip records: persists trip data
- Graph checkpoint → PostgreSQL: stores checkpoints
- Database sessions → PostgreSQL: connects to (evidence: `db/session.py`)
- Trip endpoints → Trip views: returns itinerary
- Trip endpoints → Review UI: accepts review
- Trip views → Calendar export: exports schedule
- Typed schemas → Trip state: defines typed outputs
