# uchihaobito15/agentx architecture

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

- Interactive diagram: https://gitdiagram.com/uchihaobito15/agentx
- Repository: https://github.com/uchihaobito15/agentx

## Overview

AgentX is an incident-investigation prototype: an operator selects an incident in the React dashboard, requests an investigation, reviews evidence-based findings and advisory hypotheses, and can update incident status. The FastAPI backend supplies simulated evidence, applies deterministic scenario rules, optionally asks Gemini for interpretation, and saves reports and history in SQLite. The dashboard also checks backend health and retrieves saved investigations. The graph reflects sampled calls and documented capabilities; unsampled UI details and backend internals are not inferred.

Main entry points: [`frontend/src/App.jsx`](https://github.com/uchihaobito15/agentx/blob/main/frontend/src/App.jsx) (Incident dashboard), [`backend/app/api/investigations.py`](https://github.com/uchihaobito15/agentx/blob/main/backend/app/api/investigations.py) (Investigation API), [`backend/app/database/connection.py`](https://github.com/uchihaobito15/agentx/blob/main/backend/app/database/connection.py) (Database connection), [`backend/app/api/incidents.py`](https://github.com/uchihaobito15/agentx/blob/main/backend/app/api/incidents.py) (Incident API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Operator dashboard"]
  node_dashboard_app["Incident dashboard<br/>[App.jsx]"]
  node_app_entry["React entry<br/>[main.jsx]"]
end

subgraph group_api["API layer"]
  node_fastapi["FastAPI application<br/>[main.py]"]
  node_incident_api["Incident API<br/>[incidents.py]"]
  node_investigation_api["Investigation API<br/>[investigations.py]"]
  node_health_api["Health API<br/>[health.py]"]
end

subgraph group_analysis["Investigation analysis"]
  node_investigator["Rule-based investigator<br/>[investigator.py]"]
  node_evidence["Simulated evidence<br/>[evidence.py]"]
  node_gemini["Gemini analysis<br/>[gemini_service.py]"]
end

subgraph group_persistence["Persistence and settings"]
  node_database_config["Database connection<br/>[connection.py]"]
  node_models["Incident and history models<br/>[models.py]"]
  node_sqlite[("SQLite database")]
  node_settings["Application settings<br/>[config.py]"]
end

node_operator(("Incident operator"))
node_gemini_service{{"Google Gemini service"}}

node_operator -->|"uses"| node_dashboard_app
node_app_entry -->|"renders"| node_dashboard_app
node_dashboard_app -->|"requests incidents"| node_incident_api
node_dashboard_app -->|"runs and retrieves"| node_investigation_api
node_dashboard_app -->|"checks health"| node_health_api
node_dashboard_app -->|"shows reports"| node_operator
node_fastapi -->|"registers"| node_incident_api
node_fastapi -->|"registers"| node_investigation_api
node_fastapi -->|"registers"| node_health_api
node_incident_api -->|"gets sessions"| node_database_config
node_incident_api -->|"queries and updates"| node_models
node_investigation_api -->|"runs analysis"| node_investigator
node_investigation_api -->|"gets sessions"| node_database_config
node_investigation_api -->|"reads and saves"| node_models
node_investigator -->|"loads evidence"| node_evidence
node_investigator -->|"requests interpretation"| node_gemini
node_gemini -->|"calls API"| node_gemini_service
node_database_config -->|"reads URL"| node_settings
node_models -->|"uses base"| node_database_config
node_database_config -->|"connects"| node_sqlite
node_gemini -->|"reads credentials"| node_settings

click node_dashboard_app "https://github.com/uchihaobito15/agentx/blob/main/frontend/src/App.jsx"
click node_app_entry "https://github.com/uchihaobito15/agentx/blob/main/frontend/src/main.jsx"
click node_fastapi "https://github.com/uchihaobito15/agentx/blob/main/backend/app/main.py"
click node_incident_api "https://github.com/uchihaobito15/agentx/blob/main/backend/app/api/incidents.py"
click node_investigation_api "https://github.com/uchihaobito15/agentx/blob/main/backend/app/api/investigations.py"
click node_health_api "https://github.com/uchihaobito15/agentx/blob/main/backend/app/api/health.py"
click node_investigator "https://github.com/uchihaobito15/agentx/blob/main/backend/app/agent/investigator.py"
click node_evidence "https://github.com/uchihaobito15/agentx/blob/main/backend/app/data/evidence.py"
click node_gemini "https://github.com/uchihaobito15/agentx/blob/main/backend/app/services/gemini_service.py"
click node_database_config "https://github.com/uchihaobito15/agentx/blob/main/backend/app/database/connection.py"
click node_models "https://github.com/uchihaobito15/agentx/blob/main/backend/app/database/models.py"
click node_settings "https://github.com/uchihaobito15/agentx/blob/main/backend/app/config.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_app,node_app_entry toneBlue
class node_fastapi,node_incident_api,node_investigation_api,node_health_api toneAmber
class node_investigator,node_evidence,node_gemini toneMint
class node_database_config,node_models,node_sqlite,node_settings toneRose
class node_operator,node_gemini_service toneIndigo
```

## Components

### Operator dashboard

- [Incident dashboard](https://github.com/uchihaobito15/agentx/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [React entry](https://github.com/uchihaobito15/agentx/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`

### API layer

- [FastAPI application](https://github.com/uchihaobito15/agentx/blob/main/backend/app/main.py): `backend/app/main.py`
- [Incident API](https://github.com/uchihaobito15/agentx/blob/main/backend/app/api/incidents.py): `backend/app/api/incidents.py`
- [Investigation API](https://github.com/uchihaobito15/agentx/blob/main/backend/app/api/investigations.py): `backend/app/api/investigations.py`
- [Health API](https://github.com/uchihaobito15/agentx/blob/main/backend/app/api/health.py): `backend/app/api/health.py`

### Investigation analysis

- [Rule-based investigator](https://github.com/uchihaobito15/agentx/blob/main/backend/app/agent/investigator.py): `backend/app/agent/investigator.py`
- [Simulated evidence](https://github.com/uchihaobito15/agentx/blob/main/backend/app/data/evidence.py): `backend/app/data/evidence.py`
- [Gemini analysis](https://github.com/uchihaobito15/agentx/blob/main/backend/app/services/gemini_service.py): `backend/app/services/gemini_service.py`

### Persistence and settings

- [Database connection](https://github.com/uchihaobito15/agentx/blob/main/backend/app/database/connection.py): `backend/app/database/connection.py`
- [Incident and history models](https://github.com/uchihaobito15/agentx/blob/main/backend/app/database/models.py): `backend/app/database/models.py`
- **SQLite database**
- [Application settings](https://github.com/uchihaobito15/agentx/blob/main/backend/app/config.py): `backend/app/config.py`

### Other components

- **Incident operator**
- **Google Gemini service**

## Connections

- Incident operator → Incident dashboard: uses (evidence: `README.md`)
- React entry → Incident dashboard: renders (evidence: `frontend/src/main.jsx`)
- Incident dashboard → Incident API: requests incidents (evidence: `frontend/src/App.jsx`)
- Incident dashboard → Investigation API: runs and retrieves (evidence: `frontend/src/App.jsx`)
- Incident dashboard → Health API: checks health (evidence: `frontend/src/App.jsx`)
- Incident dashboard → Incident operator: shows reports (evidence: `README.md`)
- FastAPI application → Incident API: registers (evidence: `backend/app/main.py`)
- FastAPI application → Investigation API: registers (evidence: `backend/app/main.py`)
- FastAPI application → Health API: registers (evidence: `backend/app/main.py`)
- Incident API → Database connection: gets sessions (evidence: `backend/app/api/incidents.py`)
- Incident API → Incident and history models: queries and updates (evidence: `backend/app/api/incidents.py`)
- Investigation API → Rule-based investigator: runs analysis (evidence: `backend/app/api/investigations.py`)
- Investigation API → Database connection: gets sessions (evidence: `backend/app/api/investigations.py`)
- Investigation API → Incident and history models: reads and saves (evidence: `backend/app/api/investigations.py`)
- Rule-based investigator → Simulated evidence: loads evidence (evidence: `backend/app/agent/investigator.py`)
- Rule-based investigator → Gemini analysis: requests interpretation (evidence: `backend/app/agent/investigator.py`)
- Gemini analysis → Google Gemini service: calls API (evidence: `backend/app/services/gemini_service.py`)
- Database connection → Application settings: reads URL (evidence: `backend/app/database/connection.py`)
- Incident and history models → Database connection: uses base (evidence: `backend/app/database/models.py`)
- Database connection → SQLite database: connects (evidence: `README.md`)
- Gemini analysis → Application settings: reads credentials (evidence: `backend/app/services/gemini_service.py`)
