# lagom-ta/journeypilot architecture

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

- Interactive diagram: https://gitdiagram.com/lagom-ta/journeypilot
- Repository: https://github.com/lagom-ta/journeypilot

## Overview

JourneyPilot is an evidence-backed travel-planning workspace: a traveler submits a brief, follows a fast-answer or multi-day research path, then reviews and refines a connected itinerary, evidence, map, report, and PDF. The graph preserves the documented planning stages and major capabilities, with backend run control and delivery as internal layers. Several backend stages are documented in the README but their implementation was not sampled, so those edges cite the README rather than implying source-level inspection.

Main entry points: [`src/travel_agent/agents/orchestrator/dispatcher.py`](https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/agents/orchestrator/dispatcher.py) (Parallel travel research), [`frontend/src/App.tsx`](https://github.com/lagom-ta/journeypilot/blob/main/frontend/src/App.tsx) (Web application), [`src/travel_agent/api/app.py`](https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/api/app.py) (FastAPI application), [`src/travel_agent/workflows/run_control.py`](https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/workflows/run_control.py) (Run control)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Traveler workspace"]
  node_web["Web application<br/>[App.tsx]"]
  node_session["Session and chat state<br/>[AppContext.tsx]"]
  node_session_manager["Session manager"]
  node_frontend_api["API client<br/>[api.ts]"]
  node_workspace["Trip workspace"]
end

subgraph group_serving["API and run control"]
  node_api["FastAPI application<br/>[app.py]"]
  node_chat_route["Chat and trip routes<br/>[chat.py]"]
  node_run_control["Run control<br/>[run_control.py]"]
end

subgraph group_planning["Planning and research"]
  node_fast_answer["Fast-answer workflow<br/>[fast_answer.py]"]
  node_scope["Brief and constraints<br/>[node.py]"]
  node_query_planner["Research query planning"]
  node_query_plan["Research query plan"]
  node_research["Parallel travel research<br/>[dispatcher.py]"]
  node_composition["Itinerary assembly<br/>[travel_planning.py]"]
end

subgraph group_evidence["Data and evidence"]
  node_rag["Knowledge retrieval"]
  node_mcp["Travel provider tools<br/>[mcp_manager.py]"]
  node_weather["Weather planning"]
end

subgraph group_delivery["Trip delivery"]
  node_delivery_bundle["Delivery record<br/>[delivery_bundle.py]"]
  node_delivery_view["Itinerary, map, report"]
  node_pdf["PDF export<br/>[pdf_export.py]"]
  node_database[("PostgreSQL and pgvector")]
end

node_traveler(("Traveler"))

node_traveler -->|"submits brief"| node_web
node_web -->|"uses state"| node_session
node_web -->|"shows trip view"| node_workspace
node_session_manager -->|"restores session"| node_session
node_web -.->|"requests services"| node_frontend_api
node_frontend_api -.->|"calls API"| node_api
node_api -->|"registers routes"| node_chat_route
node_chat_route -.->|"starts trip run"| node_run_control
node_run_control -->|"routes simple questions"| node_fast_answer
node_run_control -->|"routes trip brief"| node_scope
node_scope -->|"plans research"| node_query_planner
node_query_planner -->|"produces plan"| node_query_plan
node_query_planner -->|"dispatches research"| node_research
node_research -.->|"retrieves knowledge"| node_rag
node_research -->|"queries providers"| node_mcp
node_research -->|"considers forecasts"| node_weather
node_research -->|"assembles itinerary"| node_composition
node_composition -->|"creates delivery"| node_delivery_bundle
node_delivery_bundle -->|"powers workspace"| node_delivery_view
node_delivery_bundle -->|"exports report"| node_pdf
node_api -->|"persists trip data"| node_database

click node_web "https://github.com/lagom-ta/journeypilot/blob/main/frontend/src/App.tsx"
click node_session "https://github.com/lagom-ta/journeypilot/blob/main/frontend/src/context/AppContext.tsx"
click node_session_manager "https://github.com/lagom-ta/journeypilot/blob/main/frontend/src/hooks/useSessionManager.ts"
click node_frontend_api "https://github.com/lagom-ta/journeypilot/blob/main/frontend/src/lib/api.ts"
click node_workspace "https://github.com/lagom-ta/journeypilot/blob/main/frontend/src/components/workspace/TripWorkspaceShell.tsx"
click node_api "https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/api/app.py"
click node_chat_route "https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/api/routes/chat.py"
click node_run_control "https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/workflows/run_control.py"
click node_fast_answer "https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/workflows/fast_answer.py"
click node_scope "https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/agents/scope/node.py"
click node_query_planner "https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/services/research_query_planner.py"
click node_query_plan "https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/entities/research_query_plan.py"
click node_research "https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/agents/orchestrator/dispatcher.py"
click node_rag "https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/rag/retrieval_pipeline.py"
click node_mcp "https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/tools/mcp_manager.py"
click node_weather "https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/services/weather_impact_engine.py"
click node_composition "https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/workflows/travel_planning.py"
click node_delivery_bundle "https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/entities/delivery_bundle.py"
click node_delivery_view "https://github.com/lagom-ta/journeypilot/blob/main/frontend/src/components/workspace/DeliveryWorkspace.tsx"
click node_pdf "https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/services/pdf_export.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_web,node_session,node_session_manager,node_frontend_api,node_workspace toneBlue
class node_api,node_chat_route,node_run_control toneAmber
class node_fast_answer,node_scope,node_query_planner,node_query_plan,node_research,node_composition toneMint
class node_rag,node_mcp,node_weather toneRose
class node_delivery_bundle,node_delivery_view,node_pdf,node_database,node_traveler toneIndigo
```

## Components

### Traveler workspace

- [Web application](https://github.com/lagom-ta/journeypilot/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Session and chat state](https://github.com/lagom-ta/journeypilot/blob/main/frontend/src/context/AppContext.tsx): `frontend/src/context/AppContext.tsx`
- [Session manager](https://github.com/lagom-ta/journeypilot/blob/main/frontend/src/hooks/useSessionManager.ts): `frontend/src/hooks/useSessionManager.ts`
- [API client](https://github.com/lagom-ta/journeypilot/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [Trip workspace](https://github.com/lagom-ta/journeypilot/blob/main/frontend/src/components/workspace/TripWorkspaceShell.tsx): `frontend/src/components/workspace/TripWorkspaceShell.tsx`

### API and run control

- [FastAPI application](https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/api/app.py): `src/travel_agent/api/app.py`
- [Chat and trip routes](https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/api/routes/chat.py): `src/travel_agent/api/routes/chat.py`
- [Run control](https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/workflows/run_control.py): `src/travel_agent/workflows/run_control.py`

### Planning and research

- [Fast-answer workflow](https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/workflows/fast_answer.py): `src/travel_agent/workflows/fast_answer.py`
- [Brief and constraints](https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/agents/scope/node.py): `src/travel_agent/agents/scope/node.py`
- [Research query planning](https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/services/research_query_planner.py): `src/travel_agent/services/research_query_planner.py`
- [Research query plan](https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/entities/research_query_plan.py): `src/travel_agent/entities/research_query_plan.py`
- [Parallel travel research](https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/agents/orchestrator/dispatcher.py): `src/travel_agent/agents/orchestrator/dispatcher.py`
- [Itinerary assembly](https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/workflows/travel_planning.py): `src/travel_agent/workflows/travel_planning.py`

### Data and evidence

- [Knowledge retrieval](https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/rag/retrieval_pipeline.py): `src/travel_agent/rag/retrieval_pipeline.py`
- [Travel provider tools](https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/tools/mcp_manager.py): `src/travel_agent/tools/mcp_manager.py`
- [Weather planning](https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/services/weather_impact_engine.py): `src/travel_agent/services/weather_impact_engine.py`

### Trip delivery

- [Delivery record](https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/entities/delivery_bundle.py): `src/travel_agent/entities/delivery_bundle.py`
- [Itinerary, map, report](https://github.com/lagom-ta/journeypilot/blob/main/frontend/src/components/workspace/DeliveryWorkspace.tsx): `frontend/src/components/workspace/DeliveryWorkspace.tsx`
- [PDF export](https://github.com/lagom-ta/journeypilot/blob/main/src/travel_agent/services/pdf_export.py): `src/travel_agent/services/pdf_export.py`
- **PostgreSQL and pgvector**

### Other components

- **Traveler**

## Connections

- Traveler → Web application: submits brief (evidence: `README.md`)
- Web application → Session and chat state: uses state (evidence: `frontend/src/App.tsx`)
- Web application → Trip workspace: shows trip view (evidence: `frontend/src/App.tsx`)
- Session manager → Session and chat state: restores session (evidence: `frontend/src/hooks/useSessionManager.ts`)
- Web application → API client: requests services
- API client → FastAPI application: calls API
- FastAPI application → Chat and trip routes: registers routes (evidence: `src/travel_agent/api/app.py`)
- Chat and trip routes → Run control: starts trip run
- Run control → Fast-answer workflow: routes simple questions (evidence: `README.md`)
- Run control → Brief and constraints: routes trip brief (evidence: `README.md`)
- Brief and constraints → Research query planning: plans research (evidence: `README.md`)
- Research query planning → Research query plan: produces plan (evidence: `src/travel_agent/services/research_query_planner.py`)
- Research query planning → Parallel travel research: dispatches research (evidence: `README.md`)
- Parallel travel research → Knowledge retrieval: retrieves knowledge
- Parallel travel research → Travel provider tools: queries providers (evidence: `README.md`)
- Parallel travel research → Weather planning: considers forecasts (evidence: `README.md`)
- Parallel travel research → Itinerary assembly: assembles itinerary (evidence: `README.md`)
- Itinerary assembly → Delivery record: creates delivery (evidence: `README.md`)
- Delivery record → Itinerary, map, report: powers workspace (evidence: `README.md`)
- Delivery record → PDF export: exports report (evidence: `README.md`)
- FastAPI application → PostgreSQL and pgvector: persists trip data (evidence: `README.md`)
