# sreenathkalluri/virgo-ai architecture

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

- Interactive diagram: https://gitdiagram.com/sreenathkalluri/virgo-ai
- Repository: https://github.com/sreenathkalluri/virgo-ai

## Overview

Virgo is a hotel operations assistant: staff sign in, select a property and reporting date, then view dashboard metrics or ask hotel questions answered from property data. The backend also maintains provider data snapshots and processes PMS updates asynchronously. The graph preserves the documented chat, knowledge/RAG, dashboard, integrations, and background-sync branches. Source excerpts do not show the UI’s HTTP requests or all worker/cache operations, so those links are omitted rather than inferred.

Main entry points: [`backend/api_dependencies.py`](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/api_dependencies.py) (Auth dependencies), [`backend/routes/chat.py`](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/routes/chat.py) (Chat endpoint), [`backend/routes/pms.py`](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/routes/pms.py) (PMS and dashboard API), [`backend/pms_cache.py`](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/pms_cache.py) (PMS snapshot cache)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Hotel workspace"]
  node_ui["Workspace UI<br/>[Interface.tsx]"]
  node_datepicker["Report date picker"]
  node_answer["Answer renderer<br/>[AnswerContent.tsx]"]
end

subgraph group_api["API and identity"]
  node_api["FastAPI application<br/>[main.py]"]
  node_authdeps["Auth dependencies"]
  node_auth["Authentication<br/>[auth.py]"]
end

subgraph group_assistant["Chat and knowledge"]
  node_chatroute["Chat endpoint<br/>[chat.py]"]
  node_orchestrator["Chat orchestration<br/>[orchestrator.py]"]
  node_llm["Language model<br/>[llm.py]"]
  node_knowledge["Knowledge retrieval<br/>[knowledge.py]"]
  node_embeddings["Embeddings<br/>[embeddings.py]"]
  node_textsplit["Text splitting<br/>[text_splitting.py]"]
  node_indexknowledge["Knowledge indexing<br/>[index_knowledge.py]"]
end

subgraph group_pms["PMS data platform"]
  node_pmsroutes["PMS and dashboard API<br/>[pms.py]"]
  node_integrations["Integration checks<br/>[integrations.py]"]
  node_config["Property configuration<br/>[pms_config.py]"]
  node_queries["PMS queries<br/>[pms_queries.py]"]
  node_worker["Sync workers<br/>[pms_worker.py]"]
  node_eventbus["PMS event bus<br/>[pms_event_bus.py]"]
end

subgraph group_persistence["State and providers"]
  node_cache[("PMS snapshot cache<br/>[pms_cache.py]")]
  node_adapters["Provider adapters<br/>[pms_adapters.py]"]
end

node_staff(("Hotel staff"))
node_cloudbeds["Cloudbeds API<br/>[cloudbeds.py]"]
node_mews["Mews API<br/>[mews.py]"]
node_postgres[("PostgreSQL<br/>[schema.sql]")]

node_api -->|"registers"| node_authdeps
node_api -->|"registers"| node_chatroute
node_api -->|"registers"| node_pmsroutes
node_api -->|"registers"| node_integrations
node_authdeps -->|"builds auth"| node_auth
node_authdeps -->|"connects"| node_postgres
node_chatroute -->|"requires user"| node_authdeps
node_chatroute -->|"runs chat"| node_orchestrator
node_chatroute -->|"searches"| node_knowledge
node_chatroute -->|"executes tools"| node_queries
node_orchestrator -->|"defines tools"| node_queries
node_orchestrator -->|"calls model"| node_llm
node_knowledge -->|"uses"| node_embeddings
node_knowledge -->|"uses"| node_textsplit
node_indexknowledge -->|"indexes for"| node_knowledge
node_indexknowledge -->|"uses"| node_cache
node_pmsroutes -->|"requires user"| node_authdeps
node_pmsroutes -->|"calculates metrics"| node_queries
node_pmsroutes -->|"reads status"| node_cache
node_pmsroutes -->|"authorizes property"| node_config
node_integrations -->|"requires user"| node_authdeps
node_integrations -->|"validates connection"| node_cache
node_integrations -->|"selects property"| node_config
node_worker -->|"syncs snapshots"| node_cache
node_worker -->|"drains events"| node_eventbus
node_worker -->|"warms summaries"| node_queries
node_cache -->|"creates adapter"| node_adapters
node_adapters -->|"delegates"| node_cloudbeds
node_adapters -->|"delegates"| node_mews
node_staff -.->|"uses"| node_ui
node_ui -->|"renders"| node_datepicker
node_ui -->|"renders"| node_answer

click node_ui "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/virgo-ui/src/Interface.tsx"
click node_datepicker "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/virgo-ui/src/ReportDatePicker.tsx"
click node_answer "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/virgo-ui/src/AnswerContent.tsx"
click node_api "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/main.py"
click node_authdeps "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/api_dependencies.py"
click node_auth "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/auth.py"
click node_chatroute "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/routes/chat.py"
click node_orchestrator "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/orchestrator.py"
click node_llm "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/llm.py"
click node_knowledge "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/knowledge.py"
click node_embeddings "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/embeddings.py"
click node_textsplit "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/text_splitting.py"
click node_indexknowledge "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/index_knowledge.py"
click node_pmsroutes "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/routes/pms.py"
click node_integrations "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/routes/integrations.py"
click node_config "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/pms_config.py"
click node_queries "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/pms_queries.py"
click node_worker "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/pms_worker.py"
click node_eventbus "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/pms_event_bus.py"
click node_cache "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/pms_cache.py"
click node_adapters "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/pms_adapters.py"
click node_cloudbeds "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/cloudbeds.py"
click node_mews "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/mews.py"
click node_postgres "https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/database/schema.sql"

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_ui,node_datepicker,node_answer toneBlue
class node_api,node_authdeps,node_auth,node_postgres toneAmber
class node_chatroute,node_orchestrator,node_llm,node_knowledge,node_embeddings,node_textsplit,node_indexknowledge,node_cloudbeds,node_mews toneMint
class node_pmsroutes,node_integrations,node_config,node_queries,node_worker,node_eventbus toneRose
class node_cache,node_adapters,node_staff toneIndigo
```

## Components

### Hotel workspace

- [Workspace UI](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/virgo-ui/src/Interface.tsx): `virgo-ui/src/Interface.tsx`
- [Report date picker](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/virgo-ui/src/ReportDatePicker.tsx): `virgo-ui/src/ReportDatePicker.tsx`
- [Answer renderer](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/virgo-ui/src/AnswerContent.tsx): `virgo-ui/src/AnswerContent.tsx`

### API and identity

- [FastAPI application](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/main.py): `backend/main.py`
- [Auth dependencies](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/api_dependencies.py): `backend/api_dependencies.py`
- [Authentication](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/auth.py): `backend/auth.py`

### Chat and knowledge

- [Chat endpoint](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/routes/chat.py): `backend/routes/chat.py`
- [Chat orchestration](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/orchestrator.py): `backend/orchestrator.py`
- [Language model](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/llm.py): `backend/llm.py`
- [Knowledge retrieval](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/knowledge.py): `backend/knowledge.py`
- [Embeddings](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/embeddings.py): `backend/embeddings.py`
- [Text splitting](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/text_splitting.py): `backend/text_splitting.py`
- [Knowledge indexing](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/index_knowledge.py): `backend/index_knowledge.py`

### PMS data platform

- [PMS and dashboard API](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/routes/pms.py): `backend/routes/pms.py`
- [Integration checks](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/routes/integrations.py): `backend/routes/integrations.py`
- [Property configuration](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/pms_config.py): `backend/pms_config.py`
- [PMS queries](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/pms_queries.py): `backend/pms_queries.py`
- [Sync workers](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/pms_worker.py): `backend/pms_worker.py`
- [PMS event bus](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/pms_event_bus.py): `backend/pms_event_bus.py`

### State and providers

- [PMS snapshot cache](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/pms_cache.py): `backend/pms_cache.py`
- [Provider adapters](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/pms_adapters.py): `backend/pms_adapters.py`

### Other components

- **Hotel staff**
- [Cloudbeds API](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/cloudbeds.py): `backend/cloudbeds.py`
- [Mews API](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/backend/mews.py): `backend/mews.py`
- [PostgreSQL](https://github.com/sreenathkalluri/virgo-ai/blob/codex/redis-pms-upload/database/schema.sql): `database/schema.sql`

## Connections

- FastAPI application → Auth dependencies: registers (evidence: `backend/main.py`)
- FastAPI application → Chat endpoint: registers (evidence: `backend/main.py`)
- FastAPI application → PMS and dashboard API: registers (evidence: `backend/main.py`)
- FastAPI application → Integration checks: registers (evidence: `backend/main.py`)
- Auth dependencies → Authentication: builds auth (evidence: `backend/api_dependencies.py`)
- Auth dependencies → PostgreSQL: connects (evidence: `backend/api_dependencies.py`)
- Chat endpoint → Auth dependencies: requires user (evidence: `backend/routes/chat.py`)
- Chat endpoint → Chat orchestration: runs chat (evidence: `backend/routes/chat.py`)
- Chat endpoint → Knowledge retrieval: searches (evidence: `backend/routes/chat.py`)
- Chat endpoint → PMS queries: executes tools (evidence: `backend/routes/chat.py`)
- Chat orchestration → PMS queries: defines tools (evidence: `backend/orchestrator.py`)
- Chat orchestration → Language model: calls model (evidence: `backend/orchestrator.py`)
- Knowledge retrieval → Embeddings: uses (evidence: `backend/knowledge.py`)
- Knowledge retrieval → Text splitting: uses (evidence: `backend/knowledge.py`)
- Knowledge indexing → Knowledge retrieval: indexes for (evidence: `backend/index_knowledge.py`)
- Knowledge indexing → PMS snapshot cache: uses (evidence: `backend/index_knowledge.py`)
- PMS and dashboard API → Auth dependencies: requires user (evidence: `backend/routes/pms.py`)
- PMS and dashboard API → PMS queries: calculates metrics (evidence: `backend/routes/pms.py`)
- PMS and dashboard API → PMS snapshot cache: reads status (evidence: `backend/routes/pms.py`)
- PMS and dashboard API → Property configuration: authorizes property (evidence: `backend/routes/pms.py`)
- Integration checks → Auth dependencies: requires user (evidence: `backend/routes/integrations.py`)
- Integration checks → PMS snapshot cache: validates connection (evidence: `backend/routes/integrations.py`)
- Integration checks → Property configuration: selects property (evidence: `backend/routes/integrations.py`)
- Sync workers → PMS snapshot cache: syncs snapshots (evidence: `backend/pms_worker.py`)
- Sync workers → PMS event bus: drains events (evidence: `backend/pms_worker.py`)
- Sync workers → PMS queries: warms summaries (evidence: `backend/pms_worker.py`)
- PMS snapshot cache → Provider adapters: creates adapter (evidence: `backend/pms_cache.py`)
- Provider adapters → Cloudbeds API: delegates (evidence: `backend/pms_adapters.py`)
- Provider adapters → Mews API: delegates (evidence: `backend/pms_adapters.py`)
- Hotel staff → Workspace UI: uses
- Workspace UI → Report date picker: renders (evidence: `virgo-ui/src/Interface.tsx`)
- Workspace UI → Answer renderer: renders (evidence: `virgo-ui/src/Interface.tsx`)
