# hemanthh35/autonomous-ai-agent-for-it-incident-summarisation architecture

> Architecture diagram of the GitHub repository hemanthh35/autonomous-ai-agent-for-it-incident-summarisation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hemanthh35/autonomous-ai-agent-for-it-incident-summarisation
- Repository: https://github.com/hemanthh35/autonomous-ai-agent-for-it-incident-summarisation

## Overview

##### Project Type and Purpose
- This is a full-stack AI-powered incident management system.
- Purpose: Collect incident data via a React frontend, analyze with FastAPI backend using ML (root cause prediction, summarization, similarity search), and display results & analytics.

##### File Structure
- Top-level:
- frontend/ – React UI (components for form, search, dashboard, history, demo)
- main.py, summarizer.py, vector_store.py – FastAPI app and core ML modules
- predictor/ – training script, pre-trained model, synthetic logs
- incident_history.csv – CSV persistence for reported incidents
- Key patterns:
- Clear separation: frontend vs backend
- Backend follows MVC-ish structure: API (main.py) → service modules (predictor, summarizer, vector_store) → data store (CSV & FAISS)
- No relational DB; uses CSV and FAISS index

##### Additional Insights from README
- Frontend: React, Tailwind, Recharts, Axios
- Backend: FastAPI, Pydantic, Uvicorn, CORS
- ML: scikit-learn (logistic regression), Hugging Face T5-small, sentence-transformers, FAISS
- Endpoints: /predict, /summarize, /search, /history

a. Main Components
1. React Frontend (Browser)
– Components: Incident Form, Search, Dashboard, History, Demo
– HTTP Client (Axios)
2. FastAPI Backend (main.py)
– API Layer: PredictController, SummarizeController, SearchController, HistoryController
– ML Services:
- RootCauseService (uses logistic regression model)
- SummarizationService (calls T5-small transformer)
- SimilarityService (sentence-transformers + FAISS index)
– Data Layer: CSV persistence (incident_history.csv), vector store
3. Machine Learning Models
– LogisticRegression model (root_cause_model.pkl)
– T5-small transformer (downloaded at runtime)
– SentenceTransformer embeddings + FAISS index
4. Data Sources
– CSV file for incident history
– Synthetic training data (predictor/synthetic_incident_logs_10000.csv)
5. External Dependencies
– Hugging Face model hub
– FAISS library

b. Relationships and Interactions
- Browser ↔ React UI components ↔ Axios → Backend endpoints
- /predict → loads TF-IDF features → logistic regression → returns root cause
- /summarize → passes text to T5 model → returns summary
- /search → generates embeddings → queries FAISS index → returns similar incidents
- /history → reads/writes incident_history.csv → returns list
- Backend persists new incidents to CSV and updates FAISS index

c. Architectural Patterns and Principles
- Layered architecture: Presentation (frontend) → API → Service → Data
- Modular ML services: each capability in its own module
- Stateless backend: TensorFlow/PyTorch models loaded in memory, no session state
- CSV as simple persistence for quick prototyping
- Vector DB for similarity search

d. Technologies, Frameworks, Libraries
- Frontend: React 18, Tailwind CSS, Recharts, Axios
- Backend: FastAPI, Uvicorn, Pydantic
- ML: scikit-learn, transformers, sentence-transformers, faiss-cpu
- Data: CSV, FAISS index file

##### Detailed Capture of Essential Elements
- Break backend further into sub-components rather than a single block
- Data flow for each endpoint:
- Incident submission → /predict & /summarize → write to CSV → update FAISS
- Similarity search → /search → vector_store query → return matches
- History read → /history → CSV read → send list
- Model loading at startup (optional annotation)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend" 
        direction TB
        App["Main App"]:::frontend
        IncidentForm["Incident Form"]:::frontend
        SearchIncidents["Search Incidents"]:::frontend
        Dashboard["Dashboard"]:::frontend
        IncidentHistory["Incident History"]:::frontend
        DemoSimulation["Demo Simulation"]:::frontend
        SummarizeUI["Summarization UI"]:::frontend
    end

    subgraph "Backend / API" 
        direction TB
        PredictController["PredictController (/predict)"]:::api
        SummarizeController["SummarizeController (/summarize)"]:::api
        SearchController["SearchController (/search)"]:::api
        HistoryController["HistoryController (/history)"]:::api
    end

    subgraph "Services" 
        direction TB
        RootCauseService["RootCauseService"]:::ml
        SummarizationService["SummarizationService"]:::ml
        SimilarityService["SimilarityService"]:::ml
    end

    subgraph "Data Layer"
        direction TB
        CSVStore["CSV Store"]:::data
        FAISSIndex["FAISS Index"]:::data
        SyntheticData["Synthetic Training Data"]:::data
    end

    ExternalHF["Hugging Face Model Hub"]:::external

    %% Frontend to Backend
    IncidentForm -->|"/predict"| PredictController
    SummarizeUI -->|"/summarize"| SummarizeController
    SearchIncidents -->|"/search"| SearchController
    IncidentHistory -->|"/history"| HistoryController
    DemoSimulation -->|"/predict & summarize"| PredictController
    DemoSimulation -->|"/predict & summarize"| SummarizeController

    %% Backend Controllers to Services
    PredictController -->|calls| RootCauseService
    SummarizeController -->|calls| SummarizationService
    SearchController -->|calls| SimilarityService
    HistoryController -->|reads/writes| CSVStore

    %% Services to Data
    RootCauseService -->|writes incident| CSVStore
    SummarizationService -->|writes incident| CSVStore
    SummarizationService -->|updates index| FAISSIndex
    RootCauseService -->|updates index| FAISSIndex
    SimilarityService -->|queries| FAISSIndex

    %% External dependencies
    SummarizationService -->|loads model| ExternalHF
    SimilarityService -->|loads embeddings| ExternalHF
    RootCauseService -->|uses trained model| SyntheticData

    %% Click Events
    click App "https://github.com/hemanthh35/autonomous-ai-agent-for-it-incident-summarisation/blob/main/frontend/src/App.js"
    click IncidentForm "https://github.com/hemanthh35/autonomous-ai-agent-for-it-incident-summarisation/blob/main/frontend/src/components/IncidentForm.js"
    click SearchIncidents "https://github.com/hemanthh35/autonomous-ai-agent-for-it-incident-summarisation/blob/main/frontend/src/components/SearchIncidents.js"
    click Dashboard "https://github.com/hemanthh35/autonomous-ai-agent-for-it-incident-summarisation/blob/main/frontend/src/components/Dashboard.js"
    click IncidentHistory "https://github.com/hemanthh35/autonomous-ai-agent-for-it-incident-summarisation/blob/main/frontend/src/components/IncidentHistory.js"
    click DemoSimulation "https://github.com/hemanthh35/autonomous-ai-agent-for-it-incident-summarisation/blob/main/frontend/src/components/DemoSimulation.js"
    click SummarizeUI "https://github.com/hemanthh35/autonomous-ai-agent-for-it-incident-summarisation/blob/main/frontend/src/components/Summarize.js"
    click PredictController "https://github.com/hemanthh35/autonomous-ai-agent-for-it-incident-summarisation/blob/main/main.py"
    click RootCauseService "https://github.com/hemanthh35/autonomous-ai-agent-for-it-incident-summarisation/blob/main/predictor/train_model.py"
    click SyntheticData "https://github.com/hemanthh35/autonomous-ai-agent-for-it-incident-summarisation/blob/main/predictor/synthetic_incident_logs_10000.csv"
    click SummarizationService "https://github.com/hemanthh35/autonomous-ai-agent-for-it-incident-summarisation/blob/main/summarizer.py"
    click SimilarityService "https://github.com/hemanthh35/autonomous-ai-agent-for-it-incident-summarisation/blob/main/vector_store.py"
    click CSVStore "https://github.com/hemanthh35/autonomous-ai-agent-for-it-incident-summarisation/blob/main/incident_history.csv"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0066CC,color:#000000
    classDef api fill:#D0F2D7,stroke:#228B22,color:#000000
    classDef ml fill:#FFE0B2,stroke:#FF8C00,color:#000000
    classDef data fill:#FFF59D,stroke:#FBC02D,color:#000000
    classDef external fill:#E0E0E0,stroke:#757575,color:#000000
```
