# jang961111-hash/incident-agent-ablation architecture

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

- Interactive diagram: https://gitdiagram.com/jang961111-hash/incident-agent-ablation
- Repository: https://github.com/jang961111-hash/incident-agent-ablation

## Overview

This repository improves and measures an AI incident-response assistant for on-call engineers. The main workflow accepts an engineer’s question, routes it to chat or incident handling, gathers monitoring and runbook evidence, drafts a response, and validates it; it recommends actions rather than executing them. The graph can swap in RAG, a judge, cost controls, and tolerant async research. Separate evaluation tooling runs ablations and compares retrieval, answer quality, and judge agreement. Some subsystem links are documented in the README rather than shown in sampled implementation excerpts.

Main entry points: [`src/ext/graph_ext.py`](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/ext/graph_ext.py) (Configurable graph), [`src/agent/mcp_client.py`](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/agent/mcp_client.py) (MCP client), [`eval/run_ablation.py`](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/eval/run_ablation.py) (Ablation runner), [`src/server.py`](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/server.py) (Chat API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Agent runtime"]
  node_api["Chat API<br/>[server.py]"]
  node_supervisor["Supervisor graph<br/>[graph.py]"]
  node_routing["Route and plan<br/>[graph.py]"]
  node_research["Research tasks<br/>[graph.py]"]
  node_analysis["Analysis gate<br/>[graph.py]"]
  node_writer["Answer writing<br/>[graph.py]"]
  node_validator["Answer validation<br/>[graph.py]"]
  node_llm["LLM backends<br/>[openai_llm.py]"]
end

subgraph group_evidence["Evidence and integrations"]
  node_mcp_client["MCP client<br/>[mcp_client.py]"]
  node_ops_mcp["Ops MCP server<br/>[mcp_server.py]"]
  node_docs_mcp["Docs MCP server<br/>[mcp_server_docs.py]"]
  node_monitoring[("Monitoring data")]
  node_runbooks["Runbook resources<br/>[mcp_server.py]"]
end

subgraph group_improvements["Response improvements"]
  node_rag["Runbook retrieval<br/>[rag.py]"]
  node_graph_ext["Configurable graph<br/>[graph_ext.py]"]
  node_judge["Pipeline judge<br/>[judge.py]"]
  node_factcheck["Fact checking<br/>[factcheck.py]"]
  node_meter["Cost and cache<br/>[meter.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_adapter["Run entry point<br/>[adapter.py]"]
  node_ablation["Ablation runner<br/>[run_ablation.py]"]
  node_retrieval_metrics["Retrieval metrics"]
  node_agreement["Judge agreement<br/>[agreement.py]"]
  node_independent_judge["Evaluation judge<br/>[judge.py]"]
  node_results["Evaluation results"]
end

node_engineer(("On-call engineer"))

node_engineer -->|"asks"| node_api
node_api -->|"invokes"| node_supervisor
node_api -->|"starts"| node_mcp_client
node_api -->|"configures"| node_llm
node_supervisor -->|"runs"| node_routing
node_routing -->|"dispatches"| node_research
node_research -->|"queries"| node_mcp_client
node_research -->|"collects for"| node_analysis
node_analysis -->|"provides evidence"| node_writer
node_writer -->|"submits draft"| node_validator
node_validator -->|"requests rewrite"| node_writer
node_validator -->|"returns answer"| node_api
node_mcp_client -->|"connects"| node_ops_mcp
node_mcp_client -->|"connects"| node_docs_mcp
node_ops_mcp -->|"reads"| node_monitoring
node_ops_mcp -->|"serves"| node_runbooks
node_routing -->|"gets procedure prompt"| node_mcp_client
node_routing -->|"routes and plans"| node_llm
node_writer -->|"generates"| node_llm
node_graph_ext -->|"reuses graph"| node_supervisor
node_graph_ext -->|"selects runbooks"| node_rag
node_graph_ext -->|"validates with"| node_judge
node_graph_ext -->|"checks claims"| node_factcheck
node_graph_ext -->|"meters calls"| node_meter
node_rag -->|"ranks against"| node_runbooks
node_adapter -->|"builds"| node_graph_ext
node_adapter -->|"starts"| node_mcp_client
node_ablation -->|"runs queries"| node_adapter
node_ablation -->|"scores answers"| node_independent_judge
node_ablation -->|"checks answers"| node_factcheck
node_ablation -->|"summarizes retrieval"| node_retrieval_metrics
node_ablation -->|"records"| node_results
node_agreement -->|"measures agreement"| node_results

click node_api "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/server.py"
click node_supervisor "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/agent/graph.py"
click node_routing "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/agent/graph.py"
click node_research "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/agent/graph.py"
click node_analysis "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/agent/graph.py"
click node_writer "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/agent/graph.py"
click node_validator "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/agent/graph.py"
click node_mcp_client "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/agent/mcp_client.py"
click node_ops_mcp "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/mcp_server.py"
click node_docs_mcp "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/mcp_server_docs.py"
click node_runbooks "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/mcp_server.py"
click node_llm "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/agent/openai_llm.py"
click node_rag "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/ext/rag.py"
click node_graph_ext "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/ext/graph_ext.py"
click node_judge "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/ext/judge.py"
click node_factcheck "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/ext/factcheck.py"
click node_meter "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/ext/meter.py"
click node_adapter "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/adapter.py"
click node_ablation "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/eval/run_ablation.py"
click node_retrieval_metrics "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/eval/retrieval_metrics.py"
click node_agreement "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/eval/agreement.py"
click node_independent_judge "https://github.com/jang961111-hash/incident-agent-ablation/blob/main/eval/judge.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_supervisor,node_routing,node_research,node_analysis,node_writer,node_validator,node_llm toneBlue
class node_mcp_client,node_ops_mcp,node_docs_mcp,node_monitoring,node_runbooks toneAmber
class node_rag,node_graph_ext,node_judge,node_factcheck,node_meter toneMint
class node_adapter,node_ablation,node_retrieval_metrics,node_agreement,node_independent_judge,node_results toneRose
class node_engineer toneIndigo
```

## Components

### Agent runtime

- [Chat API](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/server.py): `src/server.py`
- [Supervisor graph](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/agent/graph.py): `src/agent/graph.py`
- [Route and plan](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/agent/graph.py): `src/agent/graph.py`
- [Research tasks](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/agent/graph.py): `src/agent/graph.py`
- [Analysis gate](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/agent/graph.py): `src/agent/graph.py`
- [Answer writing](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/agent/graph.py): `src/agent/graph.py`
- [Answer validation](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/agent/graph.py): `src/agent/graph.py`
- [LLM backends](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/agent/openai_llm.py): `src/agent/openai_llm.py`

### Evidence and integrations

- [MCP client](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/agent/mcp_client.py): `src/agent/mcp_client.py`
- [Ops MCP server](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/mcp_server.py): `src/mcp_server.py`
- [Docs MCP server](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/mcp_server_docs.py): `src/mcp_server_docs.py`
- **Monitoring data**
- [Runbook resources](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/mcp_server.py): `src/mcp_server.py`

### Response improvements

- [Runbook retrieval](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/ext/rag.py): `src/ext/rag.py`
- [Configurable graph](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/ext/graph_ext.py): `src/ext/graph_ext.py`
- [Pipeline judge](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/ext/judge.py): `src/ext/judge.py`
- [Fact checking](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/ext/factcheck.py): `src/ext/factcheck.py`
- [Cost and cache](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/ext/meter.py): `src/ext/meter.py`

### Evaluation

- [Run entry point](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/src/adapter.py): `src/adapter.py`
- [Ablation runner](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/eval/run_ablation.py): `eval/run_ablation.py`
- [Retrieval metrics](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/eval/retrieval_metrics.py): `eval/retrieval_metrics.py`
- [Judge agreement](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/eval/agreement.py): `eval/agreement.py`
- [Evaluation judge](https://github.com/jang961111-hash/incident-agent-ablation/blob/main/eval/judge.py): `eval/judge.py`
- **Evaluation results**

### Other components

- **On-call engineer**

## Connections

- On-call engineer → Chat API: asks
- Chat API → Supervisor graph: invokes (evidence: `src/server.py`)
- Chat API → MCP client: starts (evidence: `src/server.py`)
- Chat API → LLM backends: configures (evidence: `src/server.py`)
- Supervisor graph → Route and plan: runs (evidence: `src/agent/graph.py`)
- Route and plan → Research tasks: dispatches (evidence: `src/agent/graph.py`)
- Research tasks → MCP client: queries (evidence: `src/agent/graph.py`)
- Research tasks → Analysis gate: collects for (evidence: `src/agent/graph.py`)
- Analysis gate → Answer writing: provides evidence (evidence: `src/agent/graph.py`)
- Answer writing → Answer validation: submits draft (evidence: `src/agent/graph.py`)
- Answer validation → Answer writing: requests rewrite (evidence: `src/agent/graph.py`)
- Answer validation → Chat API: returns answer (evidence: `src/server.py`)
- MCP client → Ops MCP server: connects (evidence: `src/agent/mcp_client.py`)
- MCP client → Docs MCP server: connects (evidence: `src/agent/mcp_client.py`)
- Ops MCP server → Monitoring data: reads
- Ops MCP server → Runbook resources: serves (evidence: `src/mcp_server.py`)
- Route and plan → MCP client: gets procedure prompt (evidence: `src/agent/graph.py`)
- Route and plan → LLM backends: routes and plans (evidence: `src/agent/graph.py`)
- Answer writing → LLM backends: generates
- Configurable graph → Supervisor graph: reuses graph (evidence: `src/ext/graph_ext.py`)
- Configurable graph → Runbook retrieval: selects runbooks (evidence: `src/ext/graph_ext.py`)
- Configurable graph → Pipeline judge: validates with (evidence: `src/ext/graph_ext.py`)
- Configurable graph → Fact checking: checks claims (evidence: `src/ext/graph_ext.py`)
- Configurable graph → Cost and cache: meters calls (evidence: `src/ext/graph_ext.py`)
- Runbook retrieval → Runbook resources: ranks against
- Run entry point → Configurable graph: builds (evidence: `src/adapter.py`)
- Run entry point → MCP client: starts (evidence: `src/adapter.py`)
- Ablation runner → Run entry point: runs queries (evidence: `eval/run_ablation.py`)
- Ablation runner → Evaluation judge: scores answers (evidence: `eval/run_ablation.py`)
- Ablation runner → Fact checking: checks answers (evidence: `eval/run_ablation.py`)
- Ablation runner → Retrieval metrics: summarizes retrieval (evidence: `eval/run_ablation.py`)
- Ablation runner → Evaluation results: records
- Judge agreement → Evaluation results: measures agreement
