# lasithhaputhanthri/agentic_inverter_monitoring-system architecture

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

- Interactive diagram: https://gitdiagram.com/lasithhaputhanthri/agentic_inverter_monitoring-system
- Repository: https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system

## Overview

This repository is a simulated solar-inverter fleet incident-response system. Its main workflow runs from generated telemetry through deterministic monitoring and alerting, LLM diagnosis and remediation, policy checks, human approval, sandboxed execution, and audit storage; the dashboard/API exposes incident status and decisions. The README documents MQTT and subsystem boundaries; sampled workflow and agent excerpts clarify orchestration. Some runtime wiring (notably telemetry ingestion and API-to-workflow dispatch) is not shown in the excerpts, so those links rely on the README or are omitted.

Main entry points: [`backend/workflow/graph.py`](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/workflow/graph.py) (Incident Workflow), [`backend/monitor/detector.py`](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/monitor/detector.py) (Physical Monitor), [`backend/executor/executor.py`](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/executor/executor.py) (Sandboxed Executor), [`backend/api/routes.py`](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/api/routes.py) (REST API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Fleet Simulation"]
  node_inverters["Simulated Inverters<br/>[devices.py]"]
  node_telemetry_gen["Telemetry Generator<br/>[generator.py]"]
  node_sim_runner["Simulator Runner<br/>[runner.py]"]
  node_mqtt_publisher["MQTT Publisher<br/>[publisher.py]"]
  node_mqtt_listener["MQTT Listener<br/>[listener.py]"]
  node_sim_state["Simulator State API<br/>[devices.py]"]
end

subgraph group_monitoring["Telemetry Monitoring"]
  node_telemetry_schema["Telemetry Schema<br/>[schemas.py]"]
  node_monitor["Physical Monitor<br/>[detector.py]"]
  node_baseline["Baseline Model<br/>[baseline_model.py]"]
  node_alert["Alert Models<br/>[models.py]"]
  node_config["Runtime Configuration<br/>[config.py]"]
  node_clock["Clock Utilities<br/>[clock.py]"]
  node_logging["Redacting Logging<br/>[logging.py]"]
end

subgraph group_response["Incident Response"]
  node_workflow["Incident Workflow<br/>[graph.py]"]
  node_diagnosis["Diagnosis Agent<br/>[diagnosis.py]"]
  node_remediation["Remediation Agent<br/>[remediation.py]"]
  node_llm["LLM Client<br/>[llm_client.py]"]
  node_agent_models["Agent Result Models<br/>[models.py]"]
  node_policy["Policy Engine<br/>[policy.py]"]
  node_approval["Approval Gate<br/>[approval.py]"]
  node_executor["Sandboxed Executor<br/>[executor.py]"]
end

subgraph group_access["API and Dashboard"]
  node_api["REST API<br/>[routes.py]"]
  node_auth["API Authentication<br/>[auth.py]"]
  node_dashboard["Operator Dashboard<br/>[app.py]"]
end

subgraph group_persistence["Persistence"]
  node_repositories["Data Repositories<br/>[repositories.py]"]
  node_database[("Incident Database<br/>[database.py]")]
  node_audit["Audit Sink<br/>[audit.py]"]
end

node_operator(("Operator"))
node_mqtt["MQTT Broker"]

node_sim_runner -->|"generates"| node_telemetry_gen
node_sim_runner -->|"runs fleet"| node_inverters
node_sim_runner -->|"publishes via"| node_mqtt_publisher
node_mqtt_publisher -->|"publishes telemetry"| node_mqtt
node_mqtt -->|"delivers telemetry"| node_mqtt_listener
node_mqtt_listener -->|"validates messages"| node_telemetry_schema
node_mqtt_listener -.->|"forwards telemetry"| node_monitor
node_monitor -->|"evaluates baseline"| node_baseline
node_monitor -->|"raises alerts"| node_alert
node_monitor -->|"triggers diagnosis"| node_workflow
node_workflow -->|"invokes"| node_diagnosis
node_diagnosis -->|"requests inference"| node_llm
node_diagnosis -->|"returns diagnosis"| node_agent_models
node_workflow -->|"invokes"| node_remediation
node_remediation -->|"requests inference"| node_llm
node_remediation -->|"returns proposal"| node_agent_models
node_workflow -->|"checks proposal"| node_policy
node_workflow -->|"awaits decision"| node_approval
node_operator -->|"submits decision"| node_api
node_api -->|"authenticates"| node_auth
node_api -->|"reads and records"| node_repositories
node_approval -->|"authorizes execution"| node_executor
node_workflow -->|"dispatches approved action"| node_executor
node_executor -->|"mutates simulated state"| node_sim_state
node_workflow -->|"records events"| node_audit
node_executor -->|"records execution"| node_audit
node_audit -.->|"persists records"| node_repositories
node_repositories -->|"stores records"| node_database
node_dashboard -.->|"requests status"| node_api
node_config -->|"configures provider"| node_llm
node_config -->|"configures thresholds"| node_monitor
node_clock -.->|"timestamps events"| node_workflow
node_logging -.->|"redacts logs"| node_monitor

click node_inverters "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/simulator/devices.py"
click node_telemetry_gen "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/simulator/generator.py"
click node_sim_runner "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/simulator/runner.py"
click node_mqtt_publisher "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/simulator/publisher.py"
click node_mqtt_listener "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/simulator/listener.py"
click node_telemetry_schema "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/common/schemas.py"
click node_monitor "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/monitor/detector.py"
click node_baseline "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/monitor/baseline_model.py"
click node_alert "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/monitor/models.py"
click node_workflow "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/workflow/graph.py"
click node_diagnosis "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/agents/diagnosis.py"
click node_remediation "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/agents/remediation.py"
click node_llm "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/agents/llm_client.py"
click node_agent_models "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/agents/models.py"
click node_policy "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/executor/policy.py"
click node_approval "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/workflow/approval.py"
click node_executor "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/executor/executor.py"
click node_sim_state "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/simulator/devices.py"
click node_api "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/api/routes.py"
click node_auth "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/api/auth.py"
click node_dashboard "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/frontend/dashboard/app.py"
click node_repositories "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/storage/repositories.py"
click node_database "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/storage/database.py"
click node_audit "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/workflow/audit.py"
click node_config "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/common/config.py"
click node_clock "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/common/clock.py"
click node_logging "https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/common/logging.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_inverters,node_telemetry_gen,node_sim_runner,node_mqtt_publisher,node_mqtt_listener,node_sim_state toneBlue
class node_telemetry_schema,node_monitor,node_baseline,node_alert,node_config,node_clock,node_logging toneAmber
class node_workflow,node_diagnosis,node_remediation,node_llm,node_agent_models,node_policy,node_approval,node_executor toneMint
class node_api,node_auth,node_dashboard toneRose
class node_repositories,node_database,node_audit,node_operator,node_mqtt toneIndigo
```

## Components

### Fleet Simulation

- [Simulated Inverters](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/simulator/devices.py): `simulator/devices.py`
- [Telemetry Generator](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/simulator/generator.py): `simulator/generator.py`
- [Simulator Runner](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/simulator/runner.py): `simulator/runner.py`
- [MQTT Publisher](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/simulator/publisher.py): `simulator/publisher.py`
- [MQTT Listener](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/simulator/listener.py): `simulator/listener.py`
- [Simulator State API](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/simulator/devices.py): `simulator/devices.py`

### Telemetry Monitoring

- [Telemetry Schema](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/common/schemas.py): `backend/common/schemas.py`
- [Physical Monitor](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/monitor/detector.py): `backend/monitor/detector.py`
- [Baseline Model](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/monitor/baseline_model.py): `backend/monitor/baseline_model.py`
- [Alert Models](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/monitor/models.py): `backend/monitor/models.py`
- [Runtime Configuration](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/common/config.py): `backend/common/config.py`
- [Clock Utilities](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/common/clock.py): `backend/common/clock.py`
- [Redacting Logging](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/common/logging.py): `backend/common/logging.py`

### Incident Response

- [Incident Workflow](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/workflow/graph.py): `backend/workflow/graph.py`
- [Diagnosis Agent](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/agents/diagnosis.py): `backend/agents/diagnosis.py`
- [Remediation Agent](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/agents/remediation.py): `backend/agents/remediation.py`
- [LLM Client](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/agents/llm_client.py): `backend/agents/llm_client.py`
- [Agent Result Models](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/agents/models.py): `backend/agents/models.py`
- [Policy Engine](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/executor/policy.py): `backend/executor/policy.py`
- [Approval Gate](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/workflow/approval.py): `backend/workflow/approval.py`
- [Sandboxed Executor](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/executor/executor.py): `backend/executor/executor.py`

### API and Dashboard

- [REST API](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/api/routes.py): `backend/api/routes.py`
- [API Authentication](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/api/auth.py): `backend/api/auth.py`
- [Operator Dashboard](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/frontend/dashboard/app.py): `frontend/dashboard/app.py`

### Persistence

- [Data Repositories](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/storage/repositories.py): `backend/storage/repositories.py`
- [Incident Database](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/storage/database.py): `backend/storage/database.py`
- [Audit Sink](https://github.com/lasithhaputhanthri/agentic_inverter_monitoring-system/blob/main/backend/workflow/audit.py): `backend/workflow/audit.py`

### Other components

- **Operator**
- **MQTT Broker**

## Connections

- Simulator Runner → Telemetry Generator: generates (evidence: `simulator/runner.py`)
- Simulator Runner → Simulated Inverters: runs fleet (evidence: `simulator/runner.py`)
- Simulator Runner → MQTT Publisher: publishes via (evidence: `simulator/runner.py`)
- MQTT Publisher → MQTT Broker: publishes telemetry (evidence: `README.md`)
- MQTT Broker → MQTT Listener: delivers telemetry (evidence: `README.md`)
- MQTT Listener → Telemetry Schema: validates messages (evidence: `simulator/listener.py`)
- MQTT Listener → Physical Monitor: forwards telemetry
- Physical Monitor → Baseline Model: evaluates baseline
- Physical Monitor → Alert Models: raises alerts (evidence: `backend/monitor/detector.py`)
- Physical Monitor → Incident Workflow: triggers diagnosis (evidence: `README.md`)
- Incident Workflow → Diagnosis Agent: invokes (evidence: `backend/workflow/graph.py`)
- Diagnosis Agent → LLM Client: requests inference (evidence: `backend/agents/diagnosis.py`)
- Diagnosis Agent → Agent Result Models: returns diagnosis (evidence: `backend/agents/diagnosis.py`)
- Incident Workflow → Remediation Agent: invokes (evidence: `backend/workflow/graph.py`)
- Remediation Agent → LLM Client: requests inference (evidence: `backend/agents/remediation.py`)
- Remediation Agent → Agent Result Models: returns proposal (evidence: `backend/agents/remediation.py`)
- Incident Workflow → Policy Engine: checks proposal (evidence: `backend/workflow/graph.py`)
- Incident Workflow → Approval Gate: awaits decision (evidence: `backend/workflow/graph.py`)
- Operator → REST API: submits decision (evidence: `README.md`)
- REST API → API Authentication: authenticates (evidence: `backend/api/routes.py`)
- REST API → Data Repositories: reads and records (evidence: `backend/api/routes.py`)
- Approval Gate → Sandboxed Executor: authorizes execution (evidence: `README.md`)
- Incident Workflow → Sandboxed Executor: dispatches approved action (evidence: `backend/workflow/graph.py`)
- Sandboxed Executor → Simulator State API: mutates simulated state (evidence: `README.md`)
- Incident Workflow → Audit Sink: records events (evidence: `backend/workflow/graph.py`)
- Sandboxed Executor → Audit Sink: records execution (evidence: `backend/executor/executor.py`)
- Audit Sink → Data Repositories: persists records
- Data Repositories → Incident Database: stores records (evidence: `backend/storage/database.py`)
- Operator Dashboard → REST API: requests status
- Runtime Configuration → LLM Client: configures provider (evidence: `backend/agents/llm_client.py`)
- Runtime Configuration → Physical Monitor: configures thresholds (evidence: `backend/monitor/detector.py`)
- Clock Utilities → Incident Workflow: timestamps events
- Redacting Logging → Physical Monitor: redacts logs (evidence: `backend/monitor/detector.py`)
