# m0h1tkumar/ai_sre architecture

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

- Interactive diagram: https://gitdiagram.com/m0h1tkumar/ai_sre
- Repository: https://github.com/m0h1tkumar/ai_sre

## Overview

RunbookMind is an SRE incident diagnosis and remediation-ranking application. An SRE submits or simulates an alert in the control-center UI; the API records it and dispatches diagnosis, which gathers similar incidents, log and deployment context, asks an LLM for hypotheses and fixes, and reranks fixes using remembered outcomes. SRE feedback updates metrics and is retained for future recall. The graph also preserves the documented metrics and scenario capabilities. Some tool and UI-client internals were not excerpted, so their behavior is represented only where README or indexed references support it.

Main entry points: [`app/agent/orchestrator.py`](https://github.com/m0h1tkumar/ai_sre/blob/main/app/agent/orchestrator.py) (Diagnosis Orchestrator), [`ui/src/api.ts`](https://github.com/m0h1tkumar/ai_sre/blob/main/ui/src/api.ts) (API Client), [`app/api/alerts.py`](https://github.com/m0h1tkumar/ai_sre/blob/main/app/api/alerts.py) (Alert Endpoint), [`app/api/feedback.py`](https://github.com/m0h1tkumar/ai_sre/blob/main/app/api/feedback.py) (Feedback Endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Control Center"]
  node_ui["Control Center UI<br/>[App.tsx]"]
  node_ui_api["API Client<br/>[api.ts]"]
end

subgraph group_api["Incident API"]
  node_server["FastAPI Application<br/>[main.py]"]
  node_alerts["Alert Endpoint<br/>[alerts.py]"]
  node_feedback["Feedback Endpoint<br/>[feedback.py]"]
  node_metrics_api["Metrics Endpoint<br/>[metrics.py]"]
  node_schemas["API Schemas<br/>[schemas.py]"]
end

subgraph group_agent["Diagnosis Agent"]
  node_orchestrator["Diagnosis Orchestrator<br/>[orchestrator.py]"]
  node_prompts["Prompt Builder<br/>[prompts.py]"]
  node_llm["LLM Client<br/>[llm.py]"]
  node_reranking["Fix Reranker<br/>[ranking.py]"]
  node_log_search["Log Search<br/>[search_logs.py]"]
  node_deploy_history["Deployment History<br/>[deploy_history.py]"]
  node_runbooks["Runbook Tool<br/>[runbooks.py]"]
end

subgraph group_state["Learning and Metrics"]
  node_memory["Incident Memory Client<br/>[client.py]"]
  node_memory_schema["Resolution Formatter<br/>[schema.py]"]
  node_metrics_db[("Metrics Database<br/>[metrics.py]")]
end

node_sre(("SRE"))
node_groq{{"Groq Inference"}}
node_hindsight{{"Hindsight Cloud"}}

node_sre -->|"uses"| node_ui
node_ui -->|"calls"| node_ui_api
node_ui_api -->|"submits alerts"| node_alerts
node_ui_api -->|"submits feedback"| node_feedback
node_ui_api -->|"fetches metrics"| node_metrics_api
node_server -->|"registers route"| node_alerts
node_server -->|"registers route"| node_feedback
node_server -->|"registers route"| node_metrics_api
node_alerts -->|"dispatches diagnosis"| node_orchestrator
node_alerts -->|"records alert"| node_metrics_db
node_orchestrator -->|"recalls incidents"| node_memory
node_orchestrator -->|"searches logs"| node_log_search
node_orchestrator -->|"gets deployments"| node_deploy_history
node_orchestrator -->|"builds prompt"| node_prompts
node_orchestrator -->|"requests diagnosis"| node_llm
node_llm -->|"requests inference"| node_groq
node_orchestrator -->|"reranks fixes"| node_reranking
node_memory -->|"recalls and retains"| node_hindsight
node_memory -->|"formats resolution"| node_memory_schema
node_feedback -->|"updates outcomes"| node_metrics_db
node_feedback -->|"retains resolution"| node_memory
node_metrics_api -->|"reads metrics"| node_metrics_db
node_runbooks -.-> node_orchestrator

click node_ui "https://github.com/m0h1tkumar/ai_sre/blob/main/ui/src/App.tsx"
click node_ui_api "https://github.com/m0h1tkumar/ai_sre/blob/main/ui/src/api.ts"
click node_server "https://github.com/m0h1tkumar/ai_sre/blob/main/app/main.py"
click node_alerts "https://github.com/m0h1tkumar/ai_sre/blob/main/app/api/alerts.py"
click node_feedback "https://github.com/m0h1tkumar/ai_sre/blob/main/app/api/feedback.py"
click node_metrics_api "https://github.com/m0h1tkumar/ai_sre/blob/main/app/api/metrics.py"
click node_schemas "https://github.com/m0h1tkumar/ai_sre/blob/main/app/api/schemas.py"
click node_orchestrator "https://github.com/m0h1tkumar/ai_sre/blob/main/app/agent/orchestrator.py"
click node_prompts "https://github.com/m0h1tkumar/ai_sre/blob/main/app/agent/prompts.py"
click node_llm "https://github.com/m0h1tkumar/ai_sre/blob/main/app/agent/llm.py"
click node_reranking "https://github.com/m0h1tkumar/ai_sre/blob/main/app/agent/ranking.py"
click node_log_search "https://github.com/m0h1tkumar/ai_sre/blob/main/app/tools/search_logs.py"
click node_deploy_history "https://github.com/m0h1tkumar/ai_sre/blob/main/app/tools/deploy_history.py"
click node_runbooks "https://github.com/m0h1tkumar/ai_sre/blob/main/app/tools/runbooks.py"
click node_memory "https://github.com/m0h1tkumar/ai_sre/blob/main/app/memory/client.py"
click node_memory_schema "https://github.com/m0h1tkumar/ai_sre/blob/main/app/memory/schema.py"
click node_metrics_db "https://github.com/m0h1tkumar/ai_sre/blob/main/app/db/metrics.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_ui,node_ui_api toneBlue
class node_server,node_alerts,node_feedback,node_metrics_api,node_schemas toneAmber
class node_orchestrator,node_prompts,node_llm,node_reranking,node_log_search,node_deploy_history,node_runbooks toneMint
class node_memory,node_memory_schema,node_metrics_db toneRose
class node_sre,node_groq,node_hindsight toneIndigo
```

## Components

### Control Center

- [Control Center UI](https://github.com/m0h1tkumar/ai_sre/blob/main/ui/src/App.tsx): `ui/src/App.tsx`
- [API Client](https://github.com/m0h1tkumar/ai_sre/blob/main/ui/src/api.ts): `ui/src/api.ts`

### Incident API

- [FastAPI Application](https://github.com/m0h1tkumar/ai_sre/blob/main/app/main.py): `app/main.py`
- [Alert Endpoint](https://github.com/m0h1tkumar/ai_sre/blob/main/app/api/alerts.py): `app/api/alerts.py`
- [Feedback Endpoint](https://github.com/m0h1tkumar/ai_sre/blob/main/app/api/feedback.py): `app/api/feedback.py`
- [Metrics Endpoint](https://github.com/m0h1tkumar/ai_sre/blob/main/app/api/metrics.py): `app/api/metrics.py`
- [API Schemas](https://github.com/m0h1tkumar/ai_sre/blob/main/app/api/schemas.py): `app/api/schemas.py`

### Diagnosis Agent

- [Diagnosis Orchestrator](https://github.com/m0h1tkumar/ai_sre/blob/main/app/agent/orchestrator.py): `app/agent/orchestrator.py`
- [Prompt Builder](https://github.com/m0h1tkumar/ai_sre/blob/main/app/agent/prompts.py): `app/agent/prompts.py`
- [LLM Client](https://github.com/m0h1tkumar/ai_sre/blob/main/app/agent/llm.py): `app/agent/llm.py`
- [Fix Reranker](https://github.com/m0h1tkumar/ai_sre/blob/main/app/agent/ranking.py): `app/agent/ranking.py`
- [Log Search](https://github.com/m0h1tkumar/ai_sre/blob/main/app/tools/search_logs.py): `app/tools/search_logs.py`
- [Deployment History](https://github.com/m0h1tkumar/ai_sre/blob/main/app/tools/deploy_history.py): `app/tools/deploy_history.py`
- [Runbook Tool](https://github.com/m0h1tkumar/ai_sre/blob/main/app/tools/runbooks.py): `app/tools/runbooks.py`

### Learning and Metrics

- [Incident Memory Client](https://github.com/m0h1tkumar/ai_sre/blob/main/app/memory/client.py): `app/memory/client.py`
- [Resolution Formatter](https://github.com/m0h1tkumar/ai_sre/blob/main/app/memory/schema.py): `app/memory/schema.py`
- [Metrics Database](https://github.com/m0h1tkumar/ai_sre/blob/main/app/db/metrics.py): `app/db/metrics.py`

### Other components

- **SRE**
- **Groq Inference**
- **Hindsight Cloud**

## Connections

- SRE → Control Center UI: uses (evidence: `README.md`)
- Control Center UI → API Client: calls (evidence: `ui/src/App.tsx`)
- API Client → Alert Endpoint: submits alerts (evidence: `README.md`)
- API Client → Feedback Endpoint: submits feedback (evidence: `README.md`)
- API Client → Metrics Endpoint: fetches metrics (evidence: `README.md`)
- FastAPI Application → Alert Endpoint: registers route (evidence: `app/main.py`)
- FastAPI Application → Feedback Endpoint: registers route (evidence: `app/main.py`)
- FastAPI Application → Metrics Endpoint: registers route (evidence: `app/main.py`)
- Alert Endpoint → Diagnosis Orchestrator: dispatches diagnosis (evidence: `app/api/alerts.py`)
- Alert Endpoint → Metrics Database: records alert (evidence: `app/api/alerts.py`)
- Diagnosis Orchestrator → Incident Memory Client: recalls incidents (evidence: `app/agent/orchestrator.py`)
- Diagnosis Orchestrator → Log Search: searches logs (evidence: `app/agent/orchestrator.py`)
- Diagnosis Orchestrator → Deployment History: gets deployments (evidence: `app/agent/orchestrator.py`)
- Diagnosis Orchestrator → Prompt Builder: builds prompt (evidence: `app/agent/orchestrator.py`)
- Diagnosis Orchestrator → LLM Client: requests diagnosis (evidence: `app/agent/orchestrator.py`)
- LLM Client → Groq Inference: requests inference (evidence: `app/agent/llm.py`)
- Diagnosis Orchestrator → Fix Reranker: reranks fixes (evidence: `app/agent/orchestrator.py`)
- Incident Memory Client → Hindsight Cloud: recalls and retains (evidence: `app/memory/client.py`)
- Incident Memory Client → Resolution Formatter: formats resolution (evidence: `app/memory/client.py`)
- Feedback Endpoint → Metrics Database: updates outcomes (evidence: `app/api/feedback.py`)
- Feedback Endpoint → Incident Memory Client: retains resolution (evidence: `app/api/feedback.py`)
- Metrics Endpoint → Metrics Database: reads metrics (evidence: `app/api/metrics.py`)
- Runbook Tool → Diagnosis Orchestrator
