sodiq-code/neurascale-ops

GitHub: sodiq-code/neurascale-ops

一款由 UiPath Maestro 编排的 AI 驱动型 Kubernetes 事件自主响应系统,通过大模型分析与人工审批闭环实现告警的自动化分诊、修复与成本评估。

Stars: 1 | Forks: 0

# 🛡️ NeuroScale Ops **由 UiPath Maestro 编排的 AI 驱动型 Kubernetes 事件响应系统** [![UiPath AgentHack 2026](https://img.shields.io/badge/UiPath-AgentHack%202026-FF6700?style=for-the-badge&logo=uipath)](https://devpost.com) [![赛道 1 — Maestro Case](https://img.shields.io/badge/Track%201-Maestro%20Case-1565C0?style=for-the-badge)](https://uipath.com/maestro) [![Python 3.11+](https://img.shields.io/badge/Python-3.11+-3776AB?style=for-the-badge&logo=python&logoColor=white)](https://python.org) [![Groq llama-3.3-70b](https://img.shields.io/badge/LLM-Groq%20llama--3.3--70b-F55036?style=for-the-badge)](https://groq.com) [![Kubernetes](https://img.shields.io/badge/Kubernetes-v1.29-326CE5?style=for-the-badge&logo=kubernetes&logoColor=white)](https://kubernetes.io) [![17/17 测试通过](https://img.shields.io/badge/Tests-17%2F17%20Passing-brightgreen?style=for-the-badge&logo=pytest)](tests/) [![License: MIT](https://img.shields.io/badge/License-MIT-green?style=for-the-badge)](LICENSE) ## 面临的问题 现代 Kubernetes 平台每天会产生数百个告警。工程师们每周要花费 **3 到 8 小时** 手动进行事件筛选,包括将告警上下文复制粘贴到 Slack、翻阅操作手册、运行 kubectl 命令以及撰写事后总结。在 P1 级别的事件中,响应延迟的每一分钟都在造成真实的金钱损失。 ## 解决方案 NeuroScale Ops 是一个 **7 阶段自主事件响应 pipeline**,它在 **UiPath Maestro** 的端到端编排下,将告警从 Prometheus 一路推进至已解决的事后总结——并在最关键的节点保留人工审批环节。 ``` Prometheus Alert → Maestro Case Created │ ┌────▼────┐ ┌────────┐ ┌──────────┐ ┌───────────┐ │ Detect │───▶│ Triage │───▶│ Approval │───▶│ Remediate │ │ (coded) │ │ Groq │ │ UiPath │ │ ArgoCD │ └─────────┘ │llama3.3│ │ Apps │ │ + kubectl │ └────────┘ └──────────┘ └─────┬─────┘ │ ┌───────────┐ ┌────────┐ ┌────▼──────┐ │ Post-Mortem│◀───│Sign-off│◀───│Cost Impact│ │ Doc.Under.│ │ App │ │ OpenCost │ └───────────┘ └────────┘ └───────────┘ ``` **平均修复时间 (MTTR):15 分钟以内,完全可审计,告别告警疲劳。** ## 演示截图 ### NeuroScale Ops 解决的问题 ![问题陈述与解决方案概述](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/7a2deed2d4215741.png) ### 7 阶段 Maestro Case 架构 ![包含完整技术栈与事件覆盖表的 7 阶段 Maestro Case 架构](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/3fb69bfa63215746.png) ### 实时 Pipeline — OOMKill CRITICAL 事件 ![python main.py 实时执行:Groq AI 筛选、成本分析、人工审批网关、ArgoCD 修复、事后总结](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/fa69dfd172215751.png) ### 全部 5 种事件类型 — 所有场景均已解决 ![全部 5 种场景结果表:OOMKill、CrashLoop、策略违规、成本激增、部署失败 — 全部已解决 (RESOLVED)](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/71292e0995215757.png) ### 测试套件 — 17/17 通过 ![pytest 输出:所有 pipeline 阶段的 17/17 项测试在 0.63 秒内通过](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/0915577635215803.png) ### UiPath Maestro Case 定义 ![Maestro Case 定义:7 个阶段、SLA、人工参与的环节 (human-in-loop)、UiPath 组件、MTTR 对比](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/28dee13825215808.png) ## 影响总结 ![NeuroScale Ops 影响:MTTR 从 74m 降至 <15m、SRE 参与仅需 1 次点击、每个事件的成本可视化、100% 审计追踪](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/e63fd295aa215813.png) ## 架构 ### 7 阶段 Maestro Case Pipeline | 阶段 | 名称 | 组件 | 描述 | |-------|------|-----------|-------------| | S1 | **检测** | Coded Agent (Python) | 标准化 Prometheus webhook → 事件对象。断路器去重。 | | S2 | **筛选** | Coded Agent (Python) | Groq llama-3.3-70b-versatile 根本原因分析 + 操作手册 RAG。输出结构化 JSON。 | | S3 | **审批** | UiPath Apps | 人工参与:待命工程师在执行前审查 AI 计划。 | | S4 | **修复** | Coded Agent (Python) | ArgoCD 同步、kubectl 重启、资源补丁 — 所有获批操作均被执行。 | | S5 | **成本影响** | API Workflow + Coded Agent | OpenCost 查询:当月支出 + 修复差异计算。 | | S6 | **通知与签收** | Agent Builder + UiPath Apps | 丰富的 Slack/PagerDuty 通知 + 人工签收表单。 | | S7 | **事后总结** | Document Understanding | 结构化 PDF:时间线、根本原因、成本影响、待办事项。 | ### 使用的 UiPath 组件 | 组件 | 使用方式 | |-----------|----------| | **Maestro Case** | 核心编排 — 7 阶段 case 定义、SLA、升级路径 | | **Coded Agents (Python SDK)** | 检测、筛选、修复、成本影响 agent | | **API Workflows** | Prometheus webhook 接收器、ArgoCD 触发器、OpenCost 查询 | | **Agent Builder** | 低代码 Slack/PagerDuty 通知 agent | | **UiPath Apps** | 3 个人工参与表单:筛选审批、修复审查、签收 | | **Document Understanding** | 事后总结 PDF 生成 | | **For Coding Agents (Claude)** | 架构设计、agent 实现过程(见 `docs/coding-agents/`) | ### 处理的告警类型 | 告警 | 严重性 | 自动化操作 | |-------|----------|-----------------| | CPU Throttling | CRITICAL | 修补 InferenceService 资源限制 + ArgoCD 同步 | | OOMKilled | CRITICAL | 增加内存限制 + 重启 predictor pod | | CrashLoopBackOff | HIGH | kubectl rollout restart + ArgoCD 同步 | | ArgoCD OutOfSync | HIGH | 硬刷新 + 同步至 Git HEAD | | KServe High Latency | HIGH | 扩容 deployment 副本 | | Kyverno Policy Denial | MEDIUM | 仅告警 + 人工审查 | | Node NotReady | HIGH | 告警 + PagerDuty 升级处理 | ## 仓库结构 ``` neurascale-ops/ ├── agents/ │ ├── detector/ # Stage 1: Prometheus alert normalization │ │ └── detector.py │ ├── triage/ # Stage 2: Groq llama-3.3-70b-versatile root cause analysis │ │ └── triage_agent.py │ ├── remediation/ # Stage 4: ArgoCD + kubectl execution │ │ └── remediation_agent.py │ ├── cost_impact/ # Stage 5: OpenCost financial analysis │ │ └── cost_agent.py │ ├── notification/ # Stage 6: Slack + PagerDuty bridge │ │ └── notification_agent.py │ └── tools/ │ └── kubernetes_ops.py # Shared kubectl/ArgoCD/KServe utilities │ ├── uipath/ │ ├── maestro_case/ # 7-stage Maestro Case definition │ ├── api_workflows/ # Prometheus, ArgoCD, OpenCost API schemas │ ├── agent_builder/ # Notification Agent Builder config │ └── apps/ # 3 UiPath Apps human approval forms │ ├── k8s/ │ ├── base/ # Namespace, InferenceServices, ArgoCD app, Prometheus rules │ ├── policies/ # Kyverno policies (resource limits, labels) │ └── scenarios/ # Demo scenarios for judges │ ├── runbooks/ # JSON runbooks (CPU throttling, OOM, ArgoCD, crash loop) ├── dashboard/ # Streamlit incident command center │ └── app.py ├── scripts/ │ ├── demo_run.sh # Full pipeline demo (no cluster required) │ └── trigger_test.sh # Send simulated alerts to webhook ├── docs/ │ ├── SETUP.md │ └── coding-agents/ │ └── claude-sessions/ # Documented Claude Code sessions (+2 pts bonus) ├── .env.example ├── requirements.txt ├── Dockerfile └── docker-compose.yml ``` ## 快速开始 ### 演示模式(无需集群,无需 API 密钥) ``` # 克隆并运行 git clone https://github.com/sodiq-code/neurascale-ops cd neurascale-ops cp .env.example .env # 安装 deps python3 -m venv .venv && source .venv/bin/activate pip install -r requirements.txt # 运行完整 pipeline bash scripts/demo_run.sh # 启动 dashboard streamlit run dashboard/app.py # → http://localhost:8501 ``` ### 使用 Groq API 密钥(推荐评委使用) ``` # 编辑 .env echo "GROQ_API_KEY=gsk_your-key" >> .env echo "DEMO_MODE=true" >> .env # still uses simulated K8s, real Groq llama-3.3-70b-versatile triage bash scripts/demo_run.sh ``` ### Docker ``` docker-compose up dashboard # → http://localhost:8501 ``` ### 模拟告警 ``` # 触发 CPU throttling 场景 bash scripts/trigger_test.sh cpu # 触发所有 demo 场景 bash scripts/trigger_test.sh all ``` ## 人工审批如何运作 在处理 **CRITICAL 和 HIGH 严重性的事件** 时,NeuroScale Ops 确保由人工掌握控制权: 1. **筛选 Agent** 生成修复计划(Groq llama-3.3-70b-versatile,耗时 < 5 秒) 2. 向 `#incidents` 频道发送带有计划摘要的 **Slack 通知** 3. **UiPath Apps 表单** 自动打开 — 显示: - AI 判断的根本原因 + 置信度 - 所有拟议的操作(分步说明) - 月度成本影响 - 匹配到的操作手册参考 4. **工程师批准**(或驳回/升级) — 计划立即执行 5. 保留 **审计追踪**:由谁批准、何时批准以及相关备注 LOW/MEDIUM 级别事件可配置为自动批准(无人工延迟)。 ## 成本智能 每一次事件都会包含一份由 **OpenCost** 提供支持的财务影响报告: ``` Current monthly cost: $51.20 (production namespace) Remediation delta: +$12.50/mo (memory limit increase) Downtime cost estimate: $2.56 (2h P1 at 5% revenue impact) Projected after fix: $63.70/mo ``` 这让工程师能够做出明智的决策:是现在进行修补成本低,还是后续调查成本低? ## 演示场景 | 场景 | 告警 | 预期操作 | |----------|-------|----------------| | CPU Throttling | `CPUThrottlingHigh` (CRITICAL) | 修补 CPU 限制 → ArgoCD 同步 | | OOMKilled | `KubeContainerOOMKilled` (CRITICAL) | 修补内存 → 重启 pod | | ArgoCD Drift | `ArgoCDApplicationOutOfSync` (HIGH) | 硬刷新 + 同步 | | Crash Loop | `KubePodCrashLooping` (HIGH) | Rollout 重启 → ArgoCD 同步 | ## 技术栈 - **Python 3.11** — Agent runtime - **Groq (llama-3.3-70b-versatile)** — 根本原因分析(结构化 JSON 模式) - **UiPath Maestro** — Case 编排 - **UiPath Coded Agents (Python SDK)** — Agent 执行 - **UiPath Apps** — 人工审批表单 - **UiPath Agent Builder** — 低代码通知 agent - **UiPath Document Understanding** — 事后总结生成 - **ArgoCD** — GitOps 修复 - **KServe** — ML 推理服务管理 - **Kyverno** — 策略执行 - **OpenCost** — 成本分配 - **Prometheus** — 告警检测 - **Streamlit** — 实时仪表盘 ## 团队 **独立开发:Sodiq Jimoh** — 平台工程师 GitHub: [@sodiq-code](https://github.com/sodiq-code) | Devpost: [@sodiqjimoh80](https://devpost.com/sodiqjimoh80) ## 许可证 MIT License — 详见 [LICENSE](LICENSE) *专为 UiPath AgentHack 2026 打造 · 赛道 1:Maestro Case · 2026 年 6 月提交*
标签:AIOps, Kubernetes, LLM, UiPath, Unmanaged PE, 后端开发, 子域名突变, 自定义请求头, 运维自动化, 逆向工具