# ashu7531/autosre architecture

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

- Interactive diagram: https://gitdiagram.com/ashu7531/autosre
- Repository: https://github.com/ashu7531/autosre

## Overview

AutoSRE is an incident-response agent with a dashboard and an automatic Sentry-webhook entry point. The main workflow selects or receives an incident, runs a metrics validation check, gathers crash issues, commits, and dependency health through MCP, retrieves similar incidents, and asks Gemini to produce an RCA streamed to the dashboard. The README describes broader collectors and production integrations; this graph includes only integrations demonstrated in the sampled code. The memory implementation uses PostgreSQL/pgvector, despite the README’s demo-limitations section describing an in-memory design.

Main entry points: [`src/api/index.ts`](https://github.com/ashu7531/autosre/blob/main/src/api/index.ts) (HTTP and SSE API), [`src/agent/index.ts`](https://github.com/ashu7531/autosre/blob/main/src/agent/index.ts) (Investigation agent), [`src/mcp-server/index.ts`](https://github.com/ashu7531/autosre/blob/main/src/mcp-server/index.ts) (MCP tool server), [`frontend/src/App.tsx`](https://github.com/ashu7531/autosre/blob/main/frontend/src/App.tsx) (Incident dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_dashboard_ui["Incident dashboard<br/>[App.tsx]"]
end

subgraph group_api["API orchestration"]
  node_api_server["HTTP and SSE API<br/>[index.ts]"]
  node_scenario_data["Scenario data<br/>[active.json]"]
end

subgraph group_agent["Agent reasoning"]
  node_agent_runner["Investigation agent<br/>[index.ts]"]
end

subgraph group_evidence["Evidence and memory"]
  node_mcp_tools["MCP tool server<br/>[index.ts]"]
  node_memory_search["Incident retrieval<br/>[memory.ts]"]
  node_memory_store[("Incident memory")]
end

node_operator(("Incident operator"))
node_gemini["Gemini AI"]
node_sentry["Sentry"]
node_github["GitHub"]

node_operator -->|"selects incident"| node_dashboard_ui
node_dashboard_ui -->|"requests scenarios"| node_api_server
node_api_server -->|"loads or selects"| node_scenario_data
node_dashboard_ui -->|"triggers investigation"| node_api_server
node_sentry -->|"sends webhook"| node_api_server
node_api_server -->|"runs investigation"| node_agent_runner
node_agent_runner -->|"calls tools"| node_mcp_tools
node_mcp_tools -->|"reads scenario"| node_scenario_data
node_mcp_tools -->|"fetches issues"| node_sentry
node_mcp_tools -->|"fetches commits"| node_github
node_agent_runner -->|"searches incidents"| node_memory_search
node_memory_search -->|"queries vectors"| node_memory_store
node_agent_runner -->|"requests RCA"| node_gemini
node_memory_search -->|"supplies context"| node_gemini
node_agent_runner -->|"emits events"| node_api_server
node_api_server -->|"streams updates"| node_dashboard_ui
node_api_server -->|"reads history"| node_memory_store

click node_dashboard_ui "https://github.com/ashu7531/autosre/blob/main/frontend/src/App.tsx"
click node_api_server "https://github.com/ashu7531/autosre/blob/main/src/api/index.ts"
click node_scenario_data "https://github.com/ashu7531/autosre/blob/main/src/scenarios/active.json"
click node_agent_runner "https://github.com/ashu7531/autosre/blob/main/src/agent/index.ts"
click node_mcp_tools "https://github.com/ashu7531/autosre/blob/main/src/mcp-server/index.ts"
click node_memory_search "https://github.com/ashu7531/autosre/blob/main/src/agent/memory.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_dashboard_ui toneBlue
class node_api_server,node_scenario_data toneAmber
class node_agent_runner toneMint
class node_mcp_tools,node_memory_search,node_memory_store toneRose
class node_operator,node_gemini,node_sentry,node_github toneIndigo
```

## Components

### Dashboard

- [Incident dashboard](https://github.com/ashu7531/autosre/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`

### API orchestration

- [HTTP and SSE API](https://github.com/ashu7531/autosre/blob/main/src/api/index.ts): `src/api/index.ts`
- [Scenario data](https://github.com/ashu7531/autosre/blob/main/src/scenarios/active.json): `src/scenarios/active.json`

### Agent reasoning

- [Investigation agent](https://github.com/ashu7531/autosre/blob/main/src/agent/index.ts): `src/agent/index.ts`

### Evidence and memory

- [MCP tool server](https://github.com/ashu7531/autosre/blob/main/src/mcp-server/index.ts): `src/mcp-server/index.ts`
- [Incident retrieval](https://github.com/ashu7531/autosre/blob/main/src/agent/memory.ts): `src/agent/memory.ts`
- **Incident memory**

### Other components

- **Incident operator**
- **Gemini AI**
- **Sentry**
- **GitHub**

## Connections

- Incident operator → Incident dashboard: selects incident (evidence: `frontend/src/App.tsx`)
- Incident dashboard → HTTP and SSE API: requests scenarios (evidence: `frontend/src/App.tsx`)
- HTTP and SSE API → Scenario data: loads or selects (evidence: `src/api/index.ts`)
- Incident dashboard → HTTP and SSE API: triggers investigation (evidence: `frontend/src/App.tsx`)
- Sentry → HTTP and SSE API: sends webhook (evidence: `README.md`)
- HTTP and SSE API → Investigation agent: runs investigation (evidence: `src/api/index.ts`)
- Investigation agent → MCP tool server: calls tools (evidence: `src/agent/index.ts`)
- MCP tool server → Scenario data: reads scenario (evidence: `src/mcp-server/index.ts`)
- MCP tool server → Sentry: fetches issues (evidence: `src/mcp-server/index.ts`)
- MCP tool server → GitHub: fetches commits (evidence: `src/mcp-server/index.ts`)
- Investigation agent → Incident retrieval: searches incidents (evidence: `src/agent/index.ts`)
- Incident retrieval → Incident memory: queries vectors (evidence: `src/agent/memory.ts`)
- Investigation agent → Gemini AI: requests RCA (evidence: `src/agent/index.ts`)
- Incident retrieval → Gemini AI: supplies context
- Investigation agent → HTTP and SSE API: emits events (evidence: `src/api/index.ts`)
- HTTP and SSE API → Incident dashboard: streams updates (evidence: `frontend/src/App.tsx`)
- HTTP and SSE API → Incident memory: reads history (evidence: `src/api/index.ts`)
