vib3withsimran/The-war-room
GitHub: vib3withsimran/The-war-room
通过多 AI 智能体协作自动化生产事故的分诊、根因分析和缓解方案生成的应急响应平台。
Stars: 1 | Forks: 1
# 🚨 The War Room:AI 驱动的应急响应平台
## 📖 项目概述
当云服务经历宕机或延迟激增时,分秒必争。传统的应急响应要求值班工程师手动检查日志、查询指标仪表板、审计近期的代码部署,并将当前问题与复杂的操作手册进行比对。
**The War Room** 是一个多智能体应急响应平台,可自动化执行这一关键工作流。它使用 **Band SDK** 协议协调专门的 AI 智能体,模拟一个同步的“作战室(War Room)”,智能体在其中交换发现、讨论原因、对置信度进行评分,并实时制定统一的缓解计划。
```
sequenceDiagram
autonumber
participant AlertSystem as Alert System
participant BandSDK as Band SDK (Channels)
participant Commander as Incident Commander (LangGraph)
participant Agents as Specialized Agents (Metrics, Logs, Change, Runbook)
AlertSystem->>BandSDK: Publish Incident Alert (incident-events)
BandSDK->>Commander: Poll Alert Envelope
Commander->>BandSDK: Fan-out Triage Tasks (triage-tasks)
BandSDK->>Agents: Poll Assigned Tasks
Note over Agents: Parallel Domain Triage
(Metrics, Logs, Changes, Runbooks) Agents->>BandSDK: Publish Domain Findings (triage-findings) Agents->>BandSDK: Post Chat Deliberation (deliberation) Note over Commander: Synthesizes Findings &
Runbook Recommendations Commander->>BandSDK: Publish Resolution Verdict (commander-verdict) ``` ## 🛠️ 技术栈与智能体框架 为了展示真实的可扩展性,**The War Room** 集成了多种现代 LLM 智能体框架,展示了如何通过单一的通信总线(即 **Band SDK**)将它们统一起来: | 智能体名称 | 角色 | 框架 / SDK | 核心逻辑 | | :--- | :--- | :--- | :--- | | **Incident Commander** | 协调者与综合者 | `LangGraph` | 协调任务分发,审查智能体观察结果,管理证据/评分,并发布最终判定。 | | **Metrics Agent** | 遥测分析师 | `CrewAI` | 分析 CPU、内存和数据库指标以寻找异常。 | | **Logs Agent** | 代码与异常审计员 | `Anthropic SDK` | 追踪执行线程和日志,以查找崩溃转储或 5xx 异常。 | | **Change Agent** | 配置与 CI/CD 审计员 | `Pydantic AI` | 检测近期的生产部署、schema 更新或 flag 变更。 | | **Runbook Agent** | 操作手册匹配器 | `Claude SDK` | 检查历史操作手册以推荐即时的缓解措施。 | ## ⚖️ 证据与置信度评分(阶段 4) 该平台具有一个数学置信度评分引擎(`lib/scorer.py`),用于审查独立的发现和智能体间的通信: - **加权领域评分:** 基于领域的可靠性分配基础权重: - **Metrics Agent:** `25%` - **Logs Agent:** `25%` - **Change Agent:** `25%` - **Runbook Agent:** `15%` - **讨论协商:** `10%` - **协商协议动词:** 扫描智能体聊天记录以寻找交互 token(例如 `CHALLENGE`、`CONNECT`、`AGREE`、`SURFACE`),从而动态调整系统的置信度。 - **事件状态门控:** 评估最终的置信度分数以决定解决路径: - **已解决** (`>= 80%` 置信度) - **正在缓解** (`>= 50%` 置信度) - **已升级** (`< 50%` 置信度) ## 📁 仓库目录结构 ``` ├── agents/ # Dedicated codebases for each AI agent │ ├── commander/ # Orchestrates alerts, findings, and verdicts (LangGraph) │ ├── metrics_agent/ # Observability and metrics parsing (CrewAI) │ ├── logs_agent/ # Application log scanner (Anthropic SDK) │ ├── change_agent/ # CI/CD and deploy correlation (Pydantic AI) │ └── runbook_agent/ # Playbook lookup and mitigation (Claude SDK) ├── band/ # Agent specifications and communication channels │ ├── agents.yaml # Agent metadata registry │ └── channels.yaml # Event-driven message channel mappings ├── data/ # Mock data sources (incidents, runbooks, logs) │ └── inc-001/ # Incident simulation config containing alert JSON ├── demo/ # Walkthrough materials and execution scripts │ ├── demo-script.md # Detailed step-by-step description of the flow │ └── run_demo.py # Runnable console-based simulation script ├── lib/ # Shared utilities, Pydantic models, and client mocks │ ├── band_client.py # Mock wrapper mimicking Band SDK communication bus │ ├── models.py # Pydantic schemas (Finding, TriageTask, Verdict, Evidence) │ ├── evidence.py # In-memory EvidenceStore recording telemetry trails │ ├── scorer.py # Weighted confidence scoring & gating logic │ └── artifact_generator.py # Generates markdown postmortems and status updates ├── ui/ # Frontend Web Studio │ ├── assets/ # CSS tokens and layout stylesheets │ └── dashboard.html # Live browser-based dashboard simulation └── tests/ # Comprehensive test suites verifying agent interactions ``` ## 🚀 入门与执行 ### 1. 前置条件 确保您已安装 Python 3.10+。安装基础依赖项: ``` pip install pydantic ``` ### 2. 运行交互式 CLI 模拟 您可以在控制台中触发整个应急响应序列。这将运行指挥官,向智能体输入遥测数据,处理发现/讨论,计算置信度分数,生成 markdown 事后总结,并输出解决操作: ``` python demo/run_demo.py ``` ### 3. 启动 Web 仪表板原型(阶段 6) 在 Web 浏览器中打开带有样式的事件仪表板原型: - 找到文件 [ui/dashboard.html](file:///c:/Users/simran%20gupta/Coding/webDevelopment/projects/Not%20so%20completed%20projects/the%20war%20room/ui/dashboard.html) 并在任何标准浏览器中打开它。 - 点击 **“Execute Triage”** 以模拟实时的集群编排、智能体完成进度条以及最终的解决输出。 ### 4. 运行测试套件 验证所有智能体、证据存储、评分和判定生成器: ``` python -m pytest ``` ## 🎯 实施路线图 - [x] **阶段 1:** 指挥官分诊(警报生成与任务分发) - [x] **阶段 2:** 分析智能体(指标、日志、变更、操作手册诊断) - [x] **阶段 3:** 指挥官判定制定(跨领域关联与综合) - [x] **阶段 4:** 证据、评分与工件系统(评分引擎与事后总结生成器) - [ ] **阶段 5:** 真实数据流水线(集成实时指标 API 和部署 webhook) - [x] **阶段 6:** Web 仪表板(极简交互式 Studio UI 原型)
(Metrics, Logs, Changes, Runbooks) Agents->>BandSDK: Publish Domain Findings (triage-findings) Agents->>BandSDK: Post Chat Deliberation (deliberation) Note over Commander: Synthesizes Findings &
Runbook Recommendations Commander->>BandSDK: Publish Resolution Verdict (commander-verdict) ``` ## 🛠️ 技术栈与智能体框架 为了展示真实的可扩展性,**The War Room** 集成了多种现代 LLM 智能体框架,展示了如何通过单一的通信总线(即 **Band SDK**)将它们统一起来: | 智能体名称 | 角色 | 框架 / SDK | 核心逻辑 | | :--- | :--- | :--- | :--- | | **Incident Commander** | 协调者与综合者 | `LangGraph` | 协调任务分发,审查智能体观察结果,管理证据/评分,并发布最终判定。 | | **Metrics Agent** | 遥测分析师 | `CrewAI` | 分析 CPU、内存和数据库指标以寻找异常。 | | **Logs Agent** | 代码与异常审计员 | `Anthropic SDK` | 追踪执行线程和日志,以查找崩溃转储或 5xx 异常。 | | **Change Agent** | 配置与 CI/CD 审计员 | `Pydantic AI` | 检测近期的生产部署、schema 更新或 flag 变更。 | | **Runbook Agent** | 操作手册匹配器 | `Claude SDK` | 检查历史操作手册以推荐即时的缓解措施。 | ## ⚖️ 证据与置信度评分(阶段 4) 该平台具有一个数学置信度评分引擎(`lib/scorer.py`),用于审查独立的发现和智能体间的通信: - **加权领域评分:** 基于领域的可靠性分配基础权重: - **Metrics Agent:** `25%` - **Logs Agent:** `25%` - **Change Agent:** `25%` - **Runbook Agent:** `15%` - **讨论协商:** `10%` - **协商协议动词:** 扫描智能体聊天记录以寻找交互 token(例如 `CHALLENGE`、`CONNECT`、`AGREE`、`SURFACE`),从而动态调整系统的置信度。 - **事件状态门控:** 评估最终的置信度分数以决定解决路径: - **已解决** (`>= 80%` 置信度) - **正在缓解** (`>= 50%` 置信度) - **已升级** (`< 50%` 置信度) ## 📁 仓库目录结构 ``` ├── agents/ # Dedicated codebases for each AI agent │ ├── commander/ # Orchestrates alerts, findings, and verdicts (LangGraph) │ ├── metrics_agent/ # Observability and metrics parsing (CrewAI) │ ├── logs_agent/ # Application log scanner (Anthropic SDK) │ ├── change_agent/ # CI/CD and deploy correlation (Pydantic AI) │ └── runbook_agent/ # Playbook lookup and mitigation (Claude SDK) ├── band/ # Agent specifications and communication channels │ ├── agents.yaml # Agent metadata registry │ └── channels.yaml # Event-driven message channel mappings ├── data/ # Mock data sources (incidents, runbooks, logs) │ └── inc-001/ # Incident simulation config containing alert JSON ├── demo/ # Walkthrough materials and execution scripts │ ├── demo-script.md # Detailed step-by-step description of the flow │ └── run_demo.py # Runnable console-based simulation script ├── lib/ # Shared utilities, Pydantic models, and client mocks │ ├── band_client.py # Mock wrapper mimicking Band SDK communication bus │ ├── models.py # Pydantic schemas (Finding, TriageTask, Verdict, Evidence) │ ├── evidence.py # In-memory EvidenceStore recording telemetry trails │ ├── scorer.py # Weighted confidence scoring & gating logic │ └── artifact_generator.py # Generates markdown postmortems and status updates ├── ui/ # Frontend Web Studio │ ├── assets/ # CSS tokens and layout stylesheets │ └── dashboard.html # Live browser-based dashboard simulation └── tests/ # Comprehensive test suites verifying agent interactions ``` ## 🚀 入门与执行 ### 1. 前置条件 确保您已安装 Python 3.10+。安装基础依赖项: ``` pip install pydantic ``` ### 2. 运行交互式 CLI 模拟 您可以在控制台中触发整个应急响应序列。这将运行指挥官,向智能体输入遥测数据,处理发现/讨论,计算置信度分数,生成 markdown 事后总结,并输出解决操作: ``` python demo/run_demo.py ``` ### 3. 启动 Web 仪表板原型(阶段 6) 在 Web 浏览器中打开带有样式的事件仪表板原型: - 找到文件 [ui/dashboard.html](file:///c:/Users/simran%20gupta/Coding/webDevelopment/projects/Not%20so%20completed%20projects/the%20war%20room/ui/dashboard.html) 并在任何标准浏览器中打开它。 - 点击 **“Execute Triage”** 以模拟实时的集群编排、智能体完成进度条以及最终的解决输出。 ### 4. 运行测试套件 验证所有智能体、证据存储、评分和判定生成器: ``` python -m pytest ``` ## 🎯 实施路线图 - [x] **阶段 1:** 指挥官分诊(警报生成与任务分发) - [x] **阶段 2:** 分析智能体(指标、日志、变更、操作手册诊断) - [x] **阶段 3:** 指挥官判定制定(跨领域关联与综合) - [x] **阶段 4:** 证据、评分与工件系统(评分引擎与事后总结生成器) - [ ] **阶段 5:** 真实数据流水线(集成实时指标 API 和部署 webhook) - [x] **阶段 6:** Web 仪表板(极简交互式 Studio UI 原型)
标签:LangGraph, 多智能体, 根因分析, 自动化运维, 运维监控, 逆向工具