Bleibel/incident_response
GitHub: Bleibel/incident_response
基于分层多智能体架构的企业级重大事件管理平台,利用 LLM 驱动的 AI 智能体实现事件检测、根因分析与自动化响应。
Stars: 0 | Forks: 0
# Agentic AI 重大事件管理 (MIM) 平台
用于企业级重大事件管理的生产级、分层多智能体系统。
## 快速入门
```
# 安装依赖
pip install -r requirements.txt
# 配置 OpenRouter API key(LLM-powered agents 必需)
cp .env.example .env
# 编辑 .env 并添加来自 https://openrouter.ai/keys 的 OPENROUTER_API_KEY
# 运行测试
pytest tests/
# 启动 orchestrator(示例)
python -m src.mim_orchestrator
```
## LLM 集成 (OpenRouter)
所有专家智能体现在均通过 **OpenRouter** 使用 LLM 来生成决策,并在 LLM 不可用时提供确定性的兜底逻辑。
- **配置**: `src/config/settings.yaml` → `llm` 块
- **默认模型**: `openai/gpt-4o-mini` (低成本且快速)
- **服务商**: OpenRouter (`https://openrouter.ai/api/v1`)
- **必需的环境变量**: `OPENROUTER_API_KEY`
智能体会从 `prompts/*.md` 加载其系统 prompt,并携带结构化的 JSON 上下文调用 LLM。如果调用失败或未设置 API 密钥,它们将回退到内置的启发式 stub,以确保系统永远不会崩溃。
## 项目结构
```
.
├── docs/
│ └── architecture.md # Complete system architecture and design
├── schemas/
│ ├── incident.json # Incident JSON Schema
│ ├── decision_log.json # Agent decision log schema
│ ├── alert.json # Alert schema
│ ├── approval.json # Approval gate schema
│ ├── runbook.json # Runbook schema
│ └── postmortem.json # Postmortem schema
├── prompts/
│ ├── orchestrator.md # Orchestrator Agent prompt
│ ├── detection.md # Detection Agent prompt
│ ├── triage.md # Triage Agent prompt
│ ├── correlation.md # Correlation Agent prompt
│ ├── rca.md # RCA Agent prompt (sample)
│ ├── runbook.md # Runbook Agent prompt
│ ├── escalation.md # Escalation Agent prompt
│ ├── communications.md # Communications Agent prompt (sample)
│ └── postmortem.md # Postmortem Agent prompt
├── src/
│ ├── mim_orchestrator.py # Main orchestration loop (pseudocode)
│ ├── models/
│ │ └── incident_models.py # Pydantic data models
│ ├── agents/
│ │ ├── orchestrator.py # Orchestrator agent (in main loop)
│ │ ├── detection.py # Detection Agent
│ │ ├── triage.py # Triage Agent
│ │ ├── correlation.py # Correlation Agent
│ │ ├── rca.py # RCA Agent
│ │ ├── runbook.py # Runbook Agent
│ │ ├── escalation.py # Escalation Agent
│ │ ├── communications.py # Communications Agent
│ │ └── postmortem.py # Postmortem Agent
│ ├── tools/
│ │ └── tool_registry.py # Tool registry and execution layer
│ ├── guardrails/
│ │ ├── approval_gate.py # Human-in-the-loop approval gate
│ │ └── safety_policy.py # Safety policy and circuit breaker
│ ├── memory/
│ │ ├── short_term.py # Short-term memory (Redis)
│ │ └── long_term.py # Long-term memory (Vector + Graph DB)
│ └── config/
│ └── settings.yaml # Platform configuration
└── tests/
└── test_orchestrator.py # Sample tests
```
## 架构概述
- **Orchestrator Agent**: 中央协调器、状态机所有者、guardrail 执行者
- **Detection Agent**: 噪声过滤器与事件检测器
- **Triage Agent**: 严重性与影响评估器
- **Correlation Agent**: 告警聚类器与去重器
- **RCA Agent**: 基于证据的根因分析师
- **Runbook Agent**: 动作规划器与安全执行器
- **Escalation Agent**: 响应者路由器与寻呼协调器
- **Communications Agent**: 面向受众的事件沟通器
- **Postmortem Agent**: 事后审查员与知识捕获器
## 核心设计原则
1. **增强而非替代**:事件指挥官保留最终决策权。
2. **通过可解释性建立信任**:每项建议均包含证据与置信度分数。
3. **安全至上**:guardrail、审批门控与熔断器是强制性的。
4. **渐进式自主**:从 copilot 起步,逐步演变为受监督的自动化。
## 安全与 Guardrail
- 破坏性/高风险操作必须经过人工批准
- 自动修复仅适用于置信度 >= 0.85 且预先批准的安全操作
- 每个服务/操作连续失败 3 次后触发熔断
- 提供完整不可变的审计跟踪
- 支持 dry-run 模式
标签:IT运维, PyRIT, Python, Socks5代理, 多智能体系统, 搜索引擎查询, 无后门, 自动化编排, 逆向工具, 重大事件管理