devAryagupta/autonomous-incident-response-agent

GitHub: devAryagupta/autonomous-incident-response-agent

基于 LangGraph 的自主事件响应 Agent,通过确定性推理流水线自动诊断和修复 Kubernetes CrashLoopBackOff 等运维故障。

Stars: 0 | Forks: 0

# 自主事件响应 Agent(渐进式构建) 我们正按照以下计划中的方案**分阶段渐进式构建**该项目: `C:\Users\ag551\.claude\plans\https-github-com-madhurprash-langgraph-a-velvety-peacock.md`。 ## 阶段 0(当前) - 项目骨架 + 针对首个事件类别的**合成事件数据集**: **Kubernetes `CrashLoopBackOff`**。 - 确定性推理生命周期 + **LangGraph 直线编排** (`START → diagnose → hypothesize → plan_fix → validate_fix → confidence → END`)。 成功标准:`GRAPH.invoke(state)` 与 `run_deterministic_lifecycle()` 相匹配。 ## 快速开始 ### 创建虚拟环境 + 安装 ``` cd "d:\autonomous incident-response agent" py -3.12 -m venv .venv .\.venv\Scripts\Activate.ps1 python -m pip install -U pip pip install -e ".[dev]" ``` ### 生成数据集 ``` python -m incident_agent.datasets.crashloopbackoff.generate --out ".\data\synthetic\crashloopbackoff\incidents.jsonl" --n 50 ``` ### 评估预测结果(数据集层) 1. 准备一个预测文件 (`.jsonl`),每个事件 id 对应一个 JSON,例如: ``` {"schema_version":"1","incident_id":"clb-...","predicted_category":"missing_env_var","predicted_root_cause":"...","predicted_fix_summary":"..."} ``` 2. 运行: ``` python -m incident_agent.datasets.eval --dataset ".\data\synthetic\crashloopbackoff\incidents.jsonl" --predictions ".\predictions.jsonl" ``` ### 运行测试 ``` pytest ``` ## Benchmark 运行器 在数据集上运行 benchmark 并写入产物: - `predictions..jsonl` - `report..json` 示例: ``` $env:PYTHONPATH=(Resolve-Path .\src).Path py -m incident_agent.benchmark --task crashloopbackoff --dataset ".\data\synthetic\crashloopbackoff\incidents.jsonl" --baseline heuristic --out-dir ".\artifacts\benchmarks\crashloop" ``` Baselines: - `oracle`:从数据集中复制 ground-truth(健全性检查,其类别准确率应达到 1.0) - `empty`:不输出任何预测(下界) - `heuristic`:简单的关键词匹配器(无 AI),用于验证端到端的基础流程
标签:Incident Response, LangGraph, Python, 子域名突变, 安全规则引擎, 故障诊断, 无后门, 自动化运维, 逆向工具