# soham04mehra/agenti_sre architecture

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

- Interactive diagram: https://gitdiagram.com/soham04mehra/agenti_sre
- Repository: https://github.com/soham04mehra/agenti_sre

## Overview

This is an SRE incident investigation and recommendation platform: an alert enters the API, telemetry is prepared, a bounded LangGraph investigation gathers evidence, evaluates confidence and conflicts, then returns a cited RCA report with explicit uncertainty states. Diagnostic tools cover logs, metrics, deployments, code search, and historical incidents. The repository also includes a microservice demo that produces fault telemetry and a benchmark endpoint. Relationships for unsampled modules are included only where the README or SOURCE INDEX supports them; other uncertain links are omitted.

Main entry points: [`api.py`](https://github.com/soham04mehra/agenti_sre/blob/main/api.py) (Incident API), [`tools/registry.py`](https://github.com/soham04mehra/agenti_sre/blob/main/tools/registry.py) (Tool Dispatcher), [`agent/nodes.py`](https://github.com/soham04mehra/agenti_sre/blob/main/agent/nodes.py) (Investigation Stages), [`services/payment_service.py`](https://github.com/soham04mehra/agenti_sre/blob/main/services/payment_service.py) (Payment Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API and Console"]
  node_api["Incident API<br/>[api.py]"]
  node_console["Web Console<br/>[App.jsx]"]
  node_benchmark["Benchmark Endpoint<br/>[evaluate.py]"]
end

subgraph group_workflow["Investigation Workflow"]
  node_graph["Workflow Router<br/>[graph.py]"]
  node_stages["Investigation Stages<br/>[nodes.py]"]
end

subgraph group_diagnostics["Diagnostic Evidence"]
  node_tool_registry["Tool Dispatcher<br/>[registry.py]"]
  node_logs["Log Retrieval<br/>[fetch_logs.py]"]
  node_metrics_query["Metrics Query<br/>[query_metrics.py]"]
  node_deployments["Deployment Lookup<br/>[get_deployments.py]"]
  node_code_search["Code Search<br/>[search_codebase.py]"]
  node_history_tool["Similar Incidents"]
end

subgraph group_state["State and Grounding"]
  node_confidence["Confidence Scoring<br/>[confidence.py]"]
  node_citations["Citation Validation<br/>[citation.py]"]
  node_incident_state["Workflow State<br/>[state.py]"]
  node_tracing["Execution Tracing<br/>[tracer.py]"]
  node_llm["Language Model<br/>[llm.py]"]
  node_repository["Incident Repository<br/>[repository.py]"]
  node_configuration["Runtime Configuration<br/>[config.py]"]
end

subgraph group_demo["Service Telemetry"]
  node_order_service["Order Service<br/>[order_service.py]"]
  node_payment_service["Payment Service<br/>[payment_service.py]"]
  node_service_logs["Structured Logging<br/>[logger.py]"]
  node_service_metrics["Metrics Tracker<br/>[metrics.py]"]
end

node_operator(("SRE / Alert"))
node_supabase[("Supabase Store")]

node_operator -->|"submits alert"| node_api
node_api -->|"invokes workflow"| node_graph
node_api -->|"saves / loads state"| node_repository
node_api -->|"runs benchmark"| node_benchmark
node_api -->|"serves static app"| node_console
node_graph -->|"routes stages"| node_stages
node_stages -->|"dispatches tools"| node_tool_registry
node_stages -->|"evaluates evidence"| node_confidence
node_stages -->|"creates citations"| node_citations
node_stages -->|"uses reasoning"| node_llm
node_tool_registry -->|"dispatches"| node_logs
node_tool_registry -->|"dispatches"| node_metrics_query
node_tool_registry -->|"dispatches"| node_deployments
node_tool_registry -->|"dispatches"| node_code_search
node_tool_registry -->|"dispatches"| node_history_tool
node_history_tool -->|"queries history"| node_repository
node_repository -->|"reads / writes"| node_supabase
node_benchmark -->|"evaluates workflow"| node_graph
node_benchmark -->|"saves state"| node_repository
node_api -->|"prepares telemetry"| node_payment_service
node_order_service -->|"processes payment"| node_payment_service
node_order_service -->|"emits logs"| node_service_logs
node_order_service -->|"updates metrics"| node_service_metrics
node_payment_service -->|"emits logs"| node_service_logs
node_payment_service -->|"updates metrics"| node_service_metrics
node_logs -->|"reads settings"| node_configuration
node_metrics_query -->|"reads settings"| node_configuration
node_deployments -->|"reads settings"| node_configuration

click node_api "https://github.com/soham04mehra/agenti_sre/blob/main/api.py"
click node_console "https://github.com/soham04mehra/agenti_sre/blob/main/static/App.jsx"
click node_benchmark "https://github.com/soham04mehra/agenti_sre/blob/main/eval/evaluate.py"
click node_graph "https://github.com/soham04mehra/agenti_sre/blob/main/agent/graph.py"
click node_stages "https://github.com/soham04mehra/agenti_sre/blob/main/agent/nodes.py"
click node_tool_registry "https://github.com/soham04mehra/agenti_sre/blob/main/tools/registry.py"
click node_logs "https://github.com/soham04mehra/agenti_sre/blob/main/tools/fetch_logs.py"
click node_metrics_query "https://github.com/soham04mehra/agenti_sre/blob/main/tools/query_metrics.py"
click node_deployments "https://github.com/soham04mehra/agenti_sre/blob/main/tools/get_deployments.py"
click node_code_search "https://github.com/soham04mehra/agenti_sre/blob/main/tools/search_codebase.py"
click node_history_tool "https://github.com/soham04mehra/agenti_sre/blob/main/tools/retrieve_similar_incidents.py"
click node_confidence "https://github.com/soham04mehra/agenti_sre/blob/main/agent/confidence.py"
click node_citations "https://github.com/soham04mehra/agenti_sre/blob/main/agent/citation.py"
click node_incident_state "https://github.com/soham04mehra/agenti_sre/blob/main/agent/state.py"
click node_tracing "https://github.com/soham04mehra/agenti_sre/blob/main/agent/tracer.py"
click node_llm "https://github.com/soham04mehra/agenti_sre/blob/main/agent/llm.py"
click node_repository "https://github.com/soham04mehra/agenti_sre/blob/main/database/repository.py"
click node_configuration "https://github.com/soham04mehra/agenti_sre/blob/main/config.py"
click node_order_service "https://github.com/soham04mehra/agenti_sre/blob/main/services/order_service.py"
click node_payment_service "https://github.com/soham04mehra/agenti_sre/blob/main/services/payment_service.py"
click node_service_logs "https://github.com/soham04mehra/agenti_sre/blob/main/services/logger.py"
click node_service_metrics "https://github.com/soham04mehra/agenti_sre/blob/main/services/metrics.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_api,node_console,node_benchmark toneBlue
class node_graph,node_stages,node_supabase toneAmber
class node_tool_registry,node_logs,node_metrics_query,node_deployments,node_code_search,node_history_tool toneMint
class node_confidence,node_citations,node_incident_state,node_tracing,node_llm,node_repository,node_configuration toneRose
class node_order_service,node_payment_service,node_service_logs,node_service_metrics,node_operator toneIndigo
```

## Components

### API and Console

- [Incident API](https://github.com/soham04mehra/agenti_sre/blob/main/api.py): `api.py`
- [Web Console](https://github.com/soham04mehra/agenti_sre/blob/main/static/App.jsx): `static/App.jsx`
- [Benchmark Endpoint](https://github.com/soham04mehra/agenti_sre/blob/main/eval/evaluate.py): `eval/evaluate.py`

### Investigation Workflow

- [Workflow Router](https://github.com/soham04mehra/agenti_sre/blob/main/agent/graph.py): `agent/graph.py`
- [Investigation Stages](https://github.com/soham04mehra/agenti_sre/blob/main/agent/nodes.py): `agent/nodes.py`

### Diagnostic Evidence

- [Tool Dispatcher](https://github.com/soham04mehra/agenti_sre/blob/main/tools/registry.py): `tools/registry.py`
- [Log Retrieval](https://github.com/soham04mehra/agenti_sre/blob/main/tools/fetch_logs.py): `tools/fetch_logs.py`
- [Metrics Query](https://github.com/soham04mehra/agenti_sre/blob/main/tools/query_metrics.py): `tools/query_metrics.py`
- [Deployment Lookup](https://github.com/soham04mehra/agenti_sre/blob/main/tools/get_deployments.py): `tools/get_deployments.py`
- [Code Search](https://github.com/soham04mehra/agenti_sre/blob/main/tools/search_codebase.py): `tools/search_codebase.py`
- [Similar Incidents](https://github.com/soham04mehra/agenti_sre/blob/main/tools/retrieve_similar_incidents.py): `tools/retrieve_similar_incidents.py`

### State and Grounding

- [Confidence Scoring](https://github.com/soham04mehra/agenti_sre/blob/main/agent/confidence.py): `agent/confidence.py`
- [Citation Validation](https://github.com/soham04mehra/agenti_sre/blob/main/agent/citation.py): `agent/citation.py`
- [Workflow State](https://github.com/soham04mehra/agenti_sre/blob/main/agent/state.py): `agent/state.py`
- [Execution Tracing](https://github.com/soham04mehra/agenti_sre/blob/main/agent/tracer.py): `agent/tracer.py`
- [Language Model](https://github.com/soham04mehra/agenti_sre/blob/main/agent/llm.py): `agent/llm.py`
- [Incident Repository](https://github.com/soham04mehra/agenti_sre/blob/main/database/repository.py): `database/repository.py`
- [Runtime Configuration](https://github.com/soham04mehra/agenti_sre/blob/main/config.py): `config.py`

### Service Telemetry

- [Order Service](https://github.com/soham04mehra/agenti_sre/blob/main/services/order_service.py): `services/order_service.py`
- [Payment Service](https://github.com/soham04mehra/agenti_sre/blob/main/services/payment_service.py): `services/payment_service.py`
- [Structured Logging](https://github.com/soham04mehra/agenti_sre/blob/main/services/logger.py): `services/logger.py`
- [Metrics Tracker](https://github.com/soham04mehra/agenti_sre/blob/main/services/metrics.py): `services/metrics.py`

### Other components

- **SRE / Alert**
- **Supabase Store**

## Connections

- SRE / Alert → Incident API: submits alert (evidence: `api.py`)
- Incident API → Workflow Router: invokes workflow (evidence: `api.py`)
- Incident API → Incident Repository: saves / loads state (evidence: `api.py`)
- Incident API → Benchmark Endpoint: runs benchmark (evidence: `api.py`)
- Incident API → Web Console: serves static app (evidence: `api.py`)
- Workflow Router → Investigation Stages: routes stages (evidence: `agent/graph.py`)
- Investigation Stages → Tool Dispatcher: dispatches tools (evidence: `agent/nodes.py`)
- Investigation Stages → Confidence Scoring: evaluates evidence (evidence: `agent/nodes.py`)
- Investigation Stages → Citation Validation: creates citations (evidence: `agent/nodes.py`)
- Investigation Stages → Language Model: uses reasoning (evidence: `agent/nodes.py`)
- Tool Dispatcher → Log Retrieval: dispatches (evidence: `tools/registry.py`)
- Tool Dispatcher → Metrics Query: dispatches (evidence: `tools/registry.py`)
- Tool Dispatcher → Deployment Lookup: dispatches (evidence: `tools/registry.py`)
- Tool Dispatcher → Code Search: dispatches (evidence: `tools/registry.py`)
- Tool Dispatcher → Similar Incidents: dispatches (evidence: `tools/registry.py`)
- Similar Incidents → Incident Repository: queries history (evidence: `tools/retrieve_similar_incidents.py`)
- Incident Repository → Supabase Store: reads / writes (evidence: `database/repository.py`)
- Benchmark Endpoint → Workflow Router: evaluates workflow (evidence: `eval/evaluate.py`)
- Benchmark Endpoint → Incident Repository: saves state (evidence: `eval/evaluate.py`)
- Incident API → Payment Service: prepares telemetry (evidence: `api.py`)
- Order Service → Payment Service: processes payment (evidence: `services/order_service.py`)
- Order Service → Structured Logging: emits logs (evidence: `services/order_service.py`)
- Order Service → Metrics Tracker: updates metrics (evidence: `services/order_service.py`)
- Payment Service → Structured Logging: emits logs (evidence: `services/payment_service.py`)
- Payment Service → Metrics Tracker: updates metrics (evidence: `services/payment_service.py`)
- Log Retrieval → Runtime Configuration: reads settings (evidence: `tools/fetch_logs.py`)
- Metrics Query → Runtime Configuration: reads settings (evidence: `tools/query_metrics.py`)
- Deployment Lookup → Runtime Configuration: reads settings (evidence: `tools/get_deployments.py`)
