# devanshgupta11/aira architecture

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

- Interactive diagram: https://gitdiagram.com/devanshgupta11/aira
- Repository: https://github.com/devanshgupta11/aira

## Overview

AIRA is an incident-triage layer over an OpenTelemetry microservices demo and its monitoring stack. A fault in the demo produces telemetry; Prometheus evaluates AIRA alert rules and Alertmanager posts alerts to the FastAPI backend. The backend stores incidents, collects live Prometheus evidence, runs an evidence-grounded Ollama/CrewAI triage agent, and serves a console. The README also documents fault injection and the monitoring integrations. Backend call edges are supported by the source excerpts; monitoring and console relationships are documented in the README. Infrastructure internals were not sampled.

Main entry points: [`backend/app/main.py`](https://github.com/devanshgupta11/aira/blob/main/backend/app/main.py) (FastAPI backend), [`scripts/inject-fault.ps1`](https://github.com/devanshgupta11/aira/blob/main/scripts/inject-fault.ps1) (Fault controls), [`infra/alertmanager/alertmanager.yml`](https://github.com/devanshgupta11/aira/blob/main/infra/alertmanager/alertmanager.yml) (Alertmanager), [`backend/app/prometheus_tool.py`](https://github.com/devanshgupta11/aira/blob/main/backend/app/prometheus_tool.py) (Metrics evidence)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_monitoring["Monitoring and alerts"]
  node_demo["Demo services"]
  node_faults["Fault controls<br/>[inject-fault.ps1]"]
  node_otel["OTel Collector"]
  node_prom["Prometheus"]
  node_rules["AIRA alert rules<br/>[alert-rules.yml]"]
  node_am["Alertmanager<br/>[alertmanager.yml]"]
end

subgraph group_backend["Incident backend"]
  node_api["FastAPI backend<br/>[main.py]"]
  node_settings["Runtime settings<br/>[config.py]"]
  node_incidents[("Incident storage<br/>[db.py]")]
end

subgraph group_triage["Evidence and triage"]
  node_evidence["Metrics evidence<br/>[prometheus_tool.py]"]
  node_agent["Triage agent<br/>[triage_agent.py]"]
  node_ollama["Ollama model"]
end

subgraph group_console["Incident console"]
  node_consolepage["Incident console<br/>[index.html]"]
end

node_operator(("Fault operator"))
node_user(("Console user"))

node_operator -->|"injects faults"| node_faults
node_faults -->|"changes flags"| node_demo
node_demo -->|"sends telemetry"| node_otel
node_otel -->|"exports metrics"| node_prom
node_rules -->|"defines alerts"| node_prom
node_prom -->|"forwards alerts"| node_am
node_am -->|"posts webhook"| node_api
node_api -->|"stores alerts"| node_incidents
node_api -->|"collects metrics"| node_evidence
node_evidence -->|"queries metrics"| node_prom
node_api -->|"runs triage"| node_agent
node_agent -->|"prompts model"| node_ollama
node_api -->|"serves page"| node_consolepage
node_user -->|"views incidents"| node_consolepage
node_settings -->|"configures runtime"| node_api

click node_faults "https://github.com/devanshgupta11/aira/blob/main/scripts/inject-fault.ps1"
click node_rules "https://github.com/devanshgupta11/aira/blob/main/infra/alert-rules.yml"
click node_am "https://github.com/devanshgupta11/aira/blob/main/infra/alertmanager/alertmanager.yml"
click node_api "https://github.com/devanshgupta11/aira/blob/main/backend/app/main.py"
click node_settings "https://github.com/devanshgupta11/aira/blob/main/backend/app/config.py"
click node_incidents "https://github.com/devanshgupta11/aira/blob/main/backend/app/db.py"
click node_evidence "https://github.com/devanshgupta11/aira/blob/main/backend/app/prometheus_tool.py"
click node_agent "https://github.com/devanshgupta11/aira/blob/main/backend/app/triage_agent.py"
click node_consolepage "https://github.com/devanshgupta11/aira/blob/main/backend/app/static/index.html"

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_demo,node_faults,node_otel,node_prom,node_rules,node_am,node_user toneBlue
class node_api,node_settings,node_incidents toneAmber
class node_evidence,node_agent,node_ollama toneMint
class node_consolepage toneRose
class node_operator toneIndigo
```

## Components

### Monitoring and alerts

- **Demo services**
- [Fault controls](https://github.com/devanshgupta11/aira/blob/main/scripts/inject-fault.ps1): `scripts/inject-fault.ps1`
- **OTel Collector**
- **Prometheus**
- [AIRA alert rules](https://github.com/devanshgupta11/aira/blob/main/infra/alert-rules.yml): `infra/alert-rules.yml`
- [Alertmanager](https://github.com/devanshgupta11/aira/blob/main/infra/alertmanager/alertmanager.yml): `infra/alertmanager/alertmanager.yml`

### Incident backend

- [FastAPI backend](https://github.com/devanshgupta11/aira/blob/main/backend/app/main.py): `backend/app/main.py`
- [Runtime settings](https://github.com/devanshgupta11/aira/blob/main/backend/app/config.py): `backend/app/config.py`
- [Incident storage](https://github.com/devanshgupta11/aira/blob/main/backend/app/db.py): `backend/app/db.py`

### Evidence and triage

- [Metrics evidence](https://github.com/devanshgupta11/aira/blob/main/backend/app/prometheus_tool.py): `backend/app/prometheus_tool.py`
- [Triage agent](https://github.com/devanshgupta11/aira/blob/main/backend/app/triage_agent.py): `backend/app/triage_agent.py`
- **Ollama model**

### Incident console

- [Incident console](https://github.com/devanshgupta11/aira/blob/main/backend/app/static/index.html): `backend/app/static/index.html`

### Other components

- **Fault operator**
- **Console user**

## Connections

- Fault operator → Fault controls: injects faults (evidence: `README.md`)
- Fault controls → Demo services: changes flags (evidence: `README.md`)
- Demo services → OTel Collector: sends telemetry (evidence: `README.md`)
- OTel Collector → Prometheus: exports metrics (evidence: `README.md`)
- AIRA alert rules → Prometheus: defines alerts (evidence: `README.md`)
- Prometheus → Alertmanager: forwards alerts (evidence: `README.md`)
- Alertmanager → FastAPI backend: posts webhook (evidence: `README.md`)
- FastAPI backend → Incident storage: stores alerts (evidence: `backend/app/main.py`)
- FastAPI backend → Metrics evidence: collects metrics (evidence: `backend/app/main.py`)
- Metrics evidence → Prometheus: queries metrics (evidence: `README.md`)
- FastAPI backend → Triage agent: runs triage (evidence: `backend/app/main.py`)
- Triage agent → Ollama model: prompts model (evidence: `README.md`)
- FastAPI backend → Incident console: serves page (evidence: `backend/app/main.py`)
- Console user → Incident console: views incidents (evidence: `README.md`)
- Runtime settings → FastAPI backend: configures runtime (evidence: `backend/app/main.py`)
