sodiq-code/neurascale-ops
GitHub: sodiq-code/neurascale-ops
一款由 UiPath Maestro 编排的 AI 驱动型 Kubernetes 事件自主响应系统,通过大模型分析与人工审批闭环实现告警的自动化分诊、修复与成本评估。
Stars: 1 | Forks: 0
# 🛡️ NeuroScale Ops
**由 UiPath Maestro 编排的 AI 驱动型 Kubernetes 事件响应系统**
[](https://devpost.com)
[](https://uipath.com/maestro)
[](https://python.org)
[](https://groq.com)
[](https://kubernetes.io)
[](tests/)
[](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 解决的问题

### 7 阶段 Maestro Case 架构

### 实时 Pipeline — OOMKill CRITICAL 事件

### 全部 5 种事件类型 — 所有场景均已解决

### 测试套件 — 17/17 通过

### UiPath Maestro Case 定义

## 影响总结

## 架构
### 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, 后端开发, 子域名突变, 自定义请求头, 运维自动化, 逆向工具