# adi-ra1our/autonomous_ai architecture

> Architecture diagram of the GitHub repository adi-ra1our/autonomous_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/adi-ra1our/autonomous_ai
- Repository: https://github.com/adi-ra1our/autonomous_ai

## Overview

This is an AIOps infrastructure-monitoring platform: telemetry and logs enter a FastAPI pipeline, become metric and log-risk signals, are fused into severity decisions, then drive explanations, alerts, and dashboard views. A separate intelligence endpoint and optional serial ESP32 inference bridge provide additional analysis paths. The frontend routes administrators to live dashboard, incident, and performance views. Edges reflect sampled calls or README-described behavior; unsampled page and polling details are not inferred beyond documented relationships.

Main entry points: [`backend/main.py`](https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/main.py) (FastAPI Pipeline), [`frontend/Edge-AI/src/App.tsx`](https://github.com/adi-ra1our/autonomous_ai/blob/main/frontend/Edge-AI/src/App.tsx) (React Router App), [`backend/services/predictor.py`](https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/services/predictor.py) (Log Anomaly Model), [`backend/services/ai_explainer.py`](https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/services/ai_explainer.py) (AI Explainer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Ingestion &amp; APIs"]
  node_api["FastAPI Pipeline<br/>[main.py]"]
  node_predict_route["Log Prediction API<br/>[predict.py]"]
  node_intelligence_route["Analysis API<br/>[intelligence.py]"]
  node_history[("Process History<br/>[main.py]")]
end

subgraph group_analysis["Risk Intelligence"]
  node_analysis_service["Telemetry Analysis<br/>[intelligence.py]"]
  node_log_model["Log Anomaly Model<br/>[predictor.py]"]
  node_model_loader["Model Loader<br/>[loader.py]"]
  node_severity_loader["Severity Models<br/>[severity_loader.py]"]
  node_serial_bridge["ESP32 Serial Bridge"]
end

subgraph group_response["Alerts &amp; Explanations"]
  node_alerts["Alert Service<br/>[alert_service.py]"]
  node_explainer["AI Explainer<br/>[ai_explainer.py]"]
end

subgraph group_frontend["Operations Dashboard"]
  node_app["React Router App<br/>[App.tsx]"]
  node_landing["Landing Page<br/>[Landing.tsx]"]
  node_dashboard["Live Dashboard<br/>[Dashboard.tsx]"]
  node_incidents["Incident Monitor<br/>[Incidents.tsx]"]
  node_performance["Performance Monitor<br/>[Performance.tsx]"]
  node_not_found["Not Found Page<br/>[NotFound.tsx]"]
  node_notifier["Warning Notifier"]
  node_stream_hook["Backend Stream Hook"]
end

node_telemetry(("Telemetry Sources"))
node_ollama["Ollama Mistral"]
node_esp32["ESP32 Device"]
node_admin(("Administrator"))

node_telemetry -->|"submits telemetry"| node_api
node_api -->|"analyzes input"| node_analysis_service
node_analysis_service -->|"predicts log risk"| node_log_model
node_log_model -->|"loads models"| node_model_loader
node_api -->|"raises alerts"| node_alerts
node_api -->|"requests explanation"| node_explainer
node_explainer -->|"requests generation"| node_ollama
node_api -->|"stores results"| node_history
node_api -.->|"posts critical state"| node_esp32
node_intelligence_route -->|"predicts logs"| node_log_model
node_intelligence_route -->|"requests explanation"| node_explainer
node_serial_bridge -->|"predicts log anomaly"| node_log_model
node_serial_bridge -->|"loads severity models"| node_severity_loader
node_admin -->|"opens dashboard"| node_app
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_performance
node_app -->|"routes to"| node_incidents
node_app -->|"routes to"| node_not_found
node_app -->|"renders"| node_notifier
node_performance -->|"reads live stream"| node_stream_hook
node_dashboard -.->|"polls telemetry"| node_api
node_incidents -.->|"reads incident data"| node_api
node_notifier -.->|"reads warnings"| node_api

click node_api "https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/main.py"
click node_predict_route "https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/routes/predict.py"
click node_intelligence_route "https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/routes/intelligence.py"
click node_analysis_service "https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/services/intelligence.py"
click node_log_model "https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/services/predictor.py"
click node_model_loader "https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/utils/loader.py"
click node_severity_loader "https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/utils/severity_loader.py"
click node_serial_bridge "https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/esp32_model_bridge.py"
click node_history "https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/main.py"
click node_alerts "https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/services/alert_service.py"
click node_explainer "https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/services/ai_explainer.py"
click node_app "https://github.com/adi-ra1our/autonomous_ai/blob/main/frontend/Edge-AI/src/App.tsx"
click node_landing "https://github.com/adi-ra1our/autonomous_ai/blob/main/frontend/Edge-AI/src/pages/Landing.tsx"
click node_dashboard "https://github.com/adi-ra1our/autonomous_ai/blob/main/frontend/Edge-AI/src/pages/Dashboard.tsx"
click node_incidents "https://github.com/adi-ra1our/autonomous_ai/blob/main/frontend/Edge-AI/src/pages/Incidents.tsx"
click node_performance "https://github.com/adi-ra1our/autonomous_ai/blob/main/frontend/Edge-AI/src/pages/Performance.tsx"
click node_not_found "https://github.com/adi-ra1our/autonomous_ai/blob/main/frontend/Edge-AI/src/pages/NotFound.tsx"
click node_notifier "https://github.com/adi-ra1our/autonomous_ai/blob/main/frontend/Edge-AI/src/components/WarningNotifier.tsx"
click node_stream_hook "https://github.com/adi-ra1our/autonomous_ai/blob/main/frontend/Edge-AI/src/hooks/use-backend-stream.ts"

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_api,node_predict_route,node_intelligence_route,node_history toneBlue
class node_analysis_service,node_log_model,node_model_loader,node_severity_loader,node_serial_bridge toneAmber
class node_alerts,node_explainer toneMint
class node_app,node_landing,node_dashboard,node_incidents,node_performance,node_not_found,node_notifier,node_stream_hook toneRose
class node_telemetry,node_ollama,node_esp32,node_admin toneIndigo
```

## Components

### Ingestion & APIs

- [FastAPI Pipeline](https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/main.py): `backend/main.py`
- [Log Prediction API](https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/routes/predict.py): `backend/routes/predict.py`
- [Analysis API](https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/routes/intelligence.py): `backend/routes/intelligence.py`
- [Process History](https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/main.py): `backend/main.py`

### Risk Intelligence

- [Telemetry Analysis](https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/services/intelligence.py): `backend/services/intelligence.py`
- [Log Anomaly Model](https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/services/predictor.py): `backend/services/predictor.py`
- [Model Loader](https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/utils/loader.py): `backend/utils/loader.py`
- [Severity Models](https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/utils/severity_loader.py): `backend/utils/severity_loader.py`
- [ESP32 Serial Bridge](https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/esp32_model_bridge.py): `backend/esp32_model_bridge.py`

### Alerts & Explanations

- [Alert Service](https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/services/alert_service.py): `backend/services/alert_service.py`
- [AI Explainer](https://github.com/adi-ra1our/autonomous_ai/blob/main/backend/services/ai_explainer.py): `backend/services/ai_explainer.py`

### Operations Dashboard

- [React Router App](https://github.com/adi-ra1our/autonomous_ai/blob/main/frontend/Edge-AI/src/App.tsx): `frontend/Edge-AI/src/App.tsx`
- [Landing Page](https://github.com/adi-ra1our/autonomous_ai/blob/main/frontend/Edge-AI/src/pages/Landing.tsx): `frontend/Edge-AI/src/pages/Landing.tsx`
- [Live Dashboard](https://github.com/adi-ra1our/autonomous_ai/blob/main/frontend/Edge-AI/src/pages/Dashboard.tsx): `frontend/Edge-AI/src/pages/Dashboard.tsx`
- [Incident Monitor](https://github.com/adi-ra1our/autonomous_ai/blob/main/frontend/Edge-AI/src/pages/Incidents.tsx): `frontend/Edge-AI/src/pages/Incidents.tsx`
- [Performance Monitor](https://github.com/adi-ra1our/autonomous_ai/blob/main/frontend/Edge-AI/src/pages/Performance.tsx): `frontend/Edge-AI/src/pages/Performance.tsx`
- [Not Found Page](https://github.com/adi-ra1our/autonomous_ai/blob/main/frontend/Edge-AI/src/pages/NotFound.tsx): `frontend/Edge-AI/src/pages/NotFound.tsx`
- [Warning Notifier](https://github.com/adi-ra1our/autonomous_ai/blob/main/frontend/Edge-AI/src/components/WarningNotifier.tsx): `frontend/Edge-AI/src/components/WarningNotifier.tsx`
- [Backend Stream Hook](https://github.com/adi-ra1our/autonomous_ai/blob/main/frontend/Edge-AI/src/hooks/use-backend-stream.ts): `frontend/Edge-AI/src/hooks/use-backend-stream.ts`

### Other components

- **Telemetry Sources**
- **Ollama Mistral**
- **ESP32 Device**
- **Administrator**

## Connections

- Telemetry Sources → FastAPI Pipeline: submits telemetry
- FastAPI Pipeline → Telemetry Analysis: analyzes input (evidence: `backend/main.py`)
- Telemetry Analysis → Log Anomaly Model: predicts log risk (evidence: `backend/services/intelligence.py`)
- Log Anomaly Model → Model Loader: loads models (evidence: `backend/services/predictor.py`)
- FastAPI Pipeline → Alert Service: raises alerts (evidence: `backend/main.py`)
- FastAPI Pipeline → AI Explainer: requests explanation (evidence: `backend/main.py`)
- AI Explainer → Ollama Mistral: requests generation (evidence: `backend/services/ai_explainer.py`)
- FastAPI Pipeline → Process History: stores results (evidence: `backend/main.py`)
- FastAPI Pipeline → ESP32 Device: posts critical state (evidence: `backend/main.py`)
- Analysis API → Log Anomaly Model: predicts logs (evidence: `backend/routes/intelligence.py`)
- Analysis API → AI Explainer: requests explanation (evidence: `backend/routes/intelligence.py`)
- ESP32 Serial Bridge → Log Anomaly Model: predicts log anomaly (evidence: `backend/esp32_model_bridge.py`)
- ESP32 Serial Bridge → Severity Models: loads severity models (evidence: `backend/esp32_model_bridge.py`)
- Administrator → React Router App: opens dashboard
- React Router App → Landing Page: routes to (evidence: `frontend/Edge-AI/src/App.tsx`)
- React Router App → Live Dashboard: routes to (evidence: `frontend/Edge-AI/src/App.tsx`)
- React Router App → Performance Monitor: routes to (evidence: `frontend/Edge-AI/src/App.tsx`)
- React Router App → Incident Monitor: routes to (evidence: `frontend/Edge-AI/src/App.tsx`)
- React Router App → Not Found Page: routes to (evidence: `frontend/Edge-AI/src/App.tsx`)
- React Router App → Warning Notifier: renders (evidence: `frontend/Edge-AI/src/App.tsx`)
- Performance Monitor → Backend Stream Hook: reads live stream (evidence: `frontend/Edge-AI/src/pages/Performance.tsx`)
- Live Dashboard → FastAPI Pipeline: polls telemetry
- Incident Monitor → FastAPI Pipeline: reads incident data
- Warning Notifier → FastAPI Pipeline: reads warnings
