# parth237/kubesentry-ai architecture

> Architecture diagram of the GitHub repository parth237/kubesentry-ai, 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/parth237/kubesentry-ai
- Repository: https://github.com/parth237/kubesentry-ai

## Overview

KubeSentry AI is a Kubernetes incident triage dashboard. A user selects a scenario in the web UI, which requests an investigation from the FastAPI backend; the backend gathers evidence, generates a diagnosis and remediation advice, records a history entry, and returns a report for display. The README also describes live-cluster inspection and a four-stage diagnostic pipeline; the sampled implementation exposes a live-cluster probe, but the investigation endpoint currently uses sandbox scenarios. The graph reflects that distinction and does not imply live data flows through the endpoint.

Main entry points: [`main.py`](https://github.com/parth237/kubesentry-ai/blob/main/main.py) (FastAPI endpoints), [`static/app.js`](https://github.com/parth237/kubesentry-ai/blob/main/static/app.js) (Dashboard UI), [`app/k8s_investigator.py`](https://github.com/parth237/kubesentry-ai/blob/main/app/k8s_investigator.py) (Sandbox evidence), [`app/mock_data.py`](https://github.com/parth237/kubesentry-ai/blob/main/app/mock_data.py) (Scenario catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_dashboard_ui["Dashboard UI<br/>[app.js]"]
end

subgraph group_backend["API orchestration"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_history[("Incident history<br/>[main.py]")]
end

subgraph group_diagnostics["Evidence and diagnosis"]
  node_scenario_catalog["Scenario catalog<br/>[mock_data.py]"]
  node_evidence_collector["Sandbox evidence"]
  node_live_probe["Live cluster probe"]
  node_reasoning["SRE diagnosis<br/>[ai_sre_agent.py]"]
end

node_operator(("SRE operator"))
node_kubernetes{{"Kubernetes cluster"}}

node_operator -->|"uses"| node_dashboard_ui
node_dashboard_ui -->|"requests scenarios"| node_api
node_dashboard_ui -->|"submits investigation"| node_api
node_dashboard_ui -->|"requests history"| node_api
node_api -->|"returns report"| node_dashboard_ui
node_api -->|"returns history"| node_dashboard_ui
node_api -->|"collects evidence"| node_evidence_collector
node_evidence_collector -->|"reads scenarios"| node_scenario_catalog
node_api -->|"requests diagnosis"| node_reasoning
node_api -->|"records incident"| node_history
node_live_probe -->|"queries pods"| node_kubernetes

click node_dashboard_ui "https://github.com/parth237/kubesentry-ai/blob/main/static/app.js"
click node_api "https://github.com/parth237/kubesentry-ai/blob/main/main.py"
click node_history "https://github.com/parth237/kubesentry-ai/blob/main/main.py"
click node_scenario_catalog "https://github.com/parth237/kubesentry-ai/blob/main/app/mock_data.py"
click node_evidence_collector "https://github.com/parth237/kubesentry-ai/blob/main/app/k8s_investigator.py"
click node_live_probe "https://github.com/parth237/kubesentry-ai/blob/main/app/k8s_investigator.py"
click node_reasoning "https://github.com/parth237/kubesentry-ai/blob/main/app/ai_sre_agent.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_dashboard_ui toneBlue
class node_api,node_history toneAmber
class node_scenario_catalog,node_evidence_collector,node_live_probe,node_reasoning toneMint
class node_operator,node_kubernetes toneIndigo
```

## Components

### Dashboard

- [Dashboard UI](https://github.com/parth237/kubesentry-ai/blob/main/static/app.js): `static/app.js`

### API orchestration

- [FastAPI endpoints](https://github.com/parth237/kubesentry-ai/blob/main/main.py): `main.py`
- [Incident history](https://github.com/parth237/kubesentry-ai/blob/main/main.py): `main.py`

### Evidence and diagnosis

- [Scenario catalog](https://github.com/parth237/kubesentry-ai/blob/main/app/mock_data.py): `app/mock_data.py`
- [Sandbox evidence](https://github.com/parth237/kubesentry-ai/blob/main/app/k8s_investigator.py): `app/k8s_investigator.py`
- [Live cluster probe](https://github.com/parth237/kubesentry-ai/blob/main/app/k8s_investigator.py): `app/k8s_investigator.py`
- [SRE diagnosis](https://github.com/parth237/kubesentry-ai/blob/main/app/ai_sre_agent.py): `app/ai_sre_agent.py`

### Other components

- **SRE operator**
- **Kubernetes cluster**

## Connections

- SRE operator → Dashboard UI: uses (evidence: `README.md`)
- Dashboard UI → FastAPI endpoints: requests scenarios (evidence: `static/app.js`)
- Dashboard UI → FastAPI endpoints: submits investigation (evidence: `static/app.js`)
- Dashboard UI → FastAPI endpoints: requests history (evidence: `static/app.js`)
- FastAPI endpoints → Dashboard UI: returns report (evidence: `main.py`)
- FastAPI endpoints → Dashboard UI: returns history (evidence: `main.py`)
- FastAPI endpoints → Sandbox evidence: collects evidence (evidence: `main.py`)
- Sandbox evidence → Scenario catalog: reads scenarios (evidence: `app/k8s_investigator.py`)
- FastAPI endpoints → SRE diagnosis: requests diagnosis (evidence: `main.py`)
- FastAPI endpoints → Incident history: records incident (evidence: `main.py`)
- Live cluster probe → Kubernetes cluster: queries pods (evidence: `app/k8s_investigator.py`)
