tdries/uipath-hackathon-gauntlet

GitHub: tdries/uipath-hackathon-gauntlet

Gauntlet 是 UiPath 智能体的对抗性红队竞技场,通过自我博弈自动发现安全弱点并生成回归测试与修复建议。

Stars: 0 | Forks: 0

Gauntlet Adversarial Test Cloud

UiPath 智能体的对抗性红队竞技场。要么安全,要么回家。

参赛作品:UiPath AgentHack 2026赛道 3 (UiPath Test Cloud)

Watch the demo on YouTube
▶ Watch the demo on YouTube

## 项目描述 UiPath Agent Evaluations 只能告诉你,你的智能体是否通过了**你编写**的测试。它们无法告诉你,当真正的攻击者带着你从未想象过的 prompt 出现时会发生什么。 **Gauntlet 弥补了这一空白。** 一个**红队教练**智能体(由前沿 LLM 驱动)扮演对手,对抗任何 UiPath Agent、Maestro Flow 或外部目标。当现有的攻击库停止得分时,教练会**在对战中即兴发明新的攻击角色**。每一次成功的攻击都会作为永久性的回归测试自动保存到 **UiPath Test Manager** 中。每一次失败的对战都会开启一个 **Action Center 任务**,其中包含由另一个 LLM 驱动的智能体编写的具体修复建议。 最终结果是一个**智能体测试工厂**,它可以自行扩充回归测试套件,每一次对战都会被打上 **OWASP LLM Top-10** 和 **MITRE ATLAS** 的双重标签,从而生成一份合规专员也能轻松看懂的覆盖率矩阵。 ### 解决的问题 如今的智能体安全大多基于直觉。团队发布一个智能体,编写一些评估规则,然后祈祷不出问题。Gauntlet 用一个持续的对抗循环取代了“祈祷”: | 现状 | 使用 Gauntlet | |---|---| | 人工编写的静态评估规则 | 能够自动生成新评估的自我博弈 | | “我们测试过 prompt injection 了吗?” → 大概吧? | 每次发布都附带 OWASP / MITRE 覆盖率矩阵 | | 生产环境发现 Bug → 手动复现 → 手动编写测试用例 | 自动填充 Test Manager 回归条目 | | 出现故障 → 开发人员手动修补 prompt | 修复推荐器起草补丁,并开启 Action Center 任务 | ## 应用截图 ### 威胁仪表板 一目了然的租户状态。鲁棒性评分、关键发现、近期对战、快捷操作磁贴、微型覆盖率热力图。 ![仪表板](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/2bbfe3dcb9020906.png) ### 教练实验室。发明新的攻击角色 教练会选择预期奖励最高(Thompson 采样)的角色 × 姿态组合,或者要求 LLM 发明一个新组合。风险加权覆盖率表格准确显示了蓝队的弱点所在。 ![教练实验室](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/98d97c9c2c020910.png) ### 运行对战 单次对战或最多 10 次批量对战。选择红队角色、场景以及蓝队策略姿态(Standard / Lenient / Naive / External LangGraph 目标)。 ![运行对战](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/1d818c093e020916.png) ### 修复实验室 打开任何失败的对战,阅读修复推荐器的补丁建议(根本原因、建议的 system prompt 补丁、回归测试),并将其提交至 **UiPath Action Center** 等待人工审批。 ![修复实验室](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/1b83310c08020921.png) ### 数据分析 角色 × 姿态热力图、严重程度趋势、修复推荐器 pipeline 状态、每日对抗性调用次数。 ![数据分析](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/0700be62f1020926.png) ### 审计。OWASP LLM Top-10 / MITRE ATLAS 覆盖率 每次对战都经过了双重标签。审计视图以合规专员能看懂的形式回答了“我们测试了哪些类型的攻击,蓝队表现如何?”的问题。 ![审计](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/66c8f75990020931.png) ### 日志。每一次对抗性调用 完整记录、裁判裁决、修复建议链接。点击任意行即可深入查看完整的对话内容。 ![日志](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/b139fdfdfe020936.png) ## 使用的 UiPath 组件 | 组件 | 角色 | 位置 | |---|---|---| | **UiPath Automation Cloud** | 执行与编排层 | 租户:`cloud.uipath.com/thesingularityisnearer/DefaultTenant` | | **Maestro Case** (`FightArena`) | 长时间运行的对战编排;回合即任务 | [uipath/gauntlet/FightArena/](uipath/gauntlet/FightArena/) | | **Maestro Flow** (`RoundOrchestrator`) | 单个回合的端到端流程:红队攻击 → 蓝队响应 → 评判 → 打分 | [uipath/gauntlet/RoundOrchestrator/](uipath/gauntlet/RoundOrchestrator/) | | **Agent Builder** (`MetroBankCSR`) | 蓝队目标。参考客服智能体(被测系统) | [uipath/gauntlet/MetroBankCSR/](uipath/gauntlet/MetroBankCSR/) | | **Agent Builder** (`RefereeAgent`) | 裁判。根据规则对每个回合进行打分 | [uipath/gauntlet/RefereeAgent/](uipath/gauntlet/RefereeAgent/) | | **Coded Agents** (Python, LangGraph) | 红队教练 (`gauntlet coach`),修复推荐器 (`gauntlet fix`) | [src/gauntlet/](src/gauntlet/) | | **Coded App** (`gauntletapp`) | 操作员界面:威胁仪表板、教练实验室、修复实验室、数据分析、审计、日志 | [uipath/gauntlet-console/](uipath/gauntlet-console/) | | **Test Manager** | 持久化回归测试集,由教练在攻击得分时自动填充 | 通过 [scripts/import_runs_to_test_manager.py](scripts/import_runs_to_test_manager.py) 导入 | | **Action Center** | 人工介入的修复审批;从修复实验室开启的任务 | 通过 `@uipath/uipath-typescript` 从浏览器发起实时 API 调用 | | **UiPath TypeScript SDK** (`@uipath/uipath-typescript`) | 从 Coded App 向浏览器端发起调用,连接 Maestro 实例、Test Manager 和 Action Center | [uipath/gauntlet-console/src/lib/uipath.ts](uipath/gauntlet-console/src/lib/uipath.ts) | | **`uip` CLI** (最新版) | 登录、打包、发布并部署所有构件 | 在下方的设置步骤中使用 | ## 智能体类型 **混合模式。Gauntlet 同时使用了 coded agents 和来自 Agent Builder 的低代码智能体。** 这种多语言混合的方式是有意为之,旨在证明该竞技场是框架无关的。 - **Coded Agents (Python, LangGraph + 前沿 LLM):** - `gauntlet coach`。具备风险加权角色选择的对抗性红队教练 ([src/gauntlet/coach.py](src/gauntlet/coach.py)) - `gauntlet fix`。修复推荐器 ([src/gauntlet/fix.py](src/gauntlet/fix.py)) - `gauntlet referee` (本地镜像)。裁判逻辑 ([src/gauntlet/referee.py](src/gauntlet/referee.py)) - LangGraph 中的外部蓝队目标参考实现 ([src/gauntlet/blue_team_external.py](src/gauntlet/blue_team_external.py)) - **低代码智能体:** - `MetroBankCSR`。蓝队目标(被测系统) - `RefereeAgent`。租户内的裁判 - **低代码编排:** - `FightArena`。用于长时间运行对战生命周期的 Maestro **Case** - `RoundOrchestrator`。用于逐回合执行的 Maestro **Flow** - **Coded App (TypeScript + React):** - `gauntletapp`。将上述所有内容串联起来的操作员界面 ## 设置说明(供评委参考) ### 前置条件 - 启用了 **Test Cloud**、**Maestro**、**Agent Builder**、**Action Center**、**Coded Apps** 和 **Test Manager** 的 UiPath Automation Cloud 租户 - **Node.js 20+** - **Python 3.11+** - **`uip` CLI**(最新版;使用 `npm i -g @uipath/cli` 安装)。下文的解决方案 `pack` / `deploy run` 命令需要使用最新的构建版本。 - **LLM API key**(用于访问前沿模型) ### 1. 克隆并配置 ``` git clone https://github.com/tdries/uipath-hackathon-gauntlet.git cd uipath-hackathon-gauntlet cp .env.example .env # 填写 ANTHROPIC_API_KEY (必填) ``` 运行 Gauntlet 只需要 `ANTHROPIC_API_KEY`。`.env.example` 中的其他 key 是可选的:`OPENAI_API_KEY` 用于可选的多模型对比测试,而 `HEYGEN_API_KEY` / `ELEVENLABS_API_KEY` 仅用于演示视频的制作,因此请将它们留空。`UIPATH_*` 字段将在下一步的 `uip login` 中自动填充。 ### 2. 向 UiPath 验证身份 ``` uip login # 遵循浏览器流程。CLI 会将凭证写入 ~/.uipath/credentials。 ``` ### 3. 安装 Python 包 ``` python -m venv .venv source .venv/bin/activate pip install -e . ``` 这将暴露 `gauntlet` CLI。`fight` / `coach` / `fix` 命令会发起实时 LLM 调用,因此需要在 `.env` 中设置 `ANTHROPIC_API_KEY`: ``` gauntlet --help # list every command gauntlet personas # list the 8 red-team personas gauntlet scenarios # list the 15 fight scenarios # 运行一场实战对战:gauntlet fight --scenario # --blue-mode 为以下之一:standard | lenient | naive | external gauntlet fight fake-ceo --scenario acme-roofing-bec --blue-mode naive # 让 Coach 阅读语料库并创建一个全新的攻击 persona,然后与其对战: gauntlet coach --auto-fight # 为失败的实战起草修复方案(传入 runs/ 中的任意运行文件): gauntlet fix runs/20260516-163715-fight-d6c8ae26-fake-ceo-lenient.json ``` ### 4. 部署 UiPath 解决方案 完整的 UiPath 解决方案(Maestro Case + Flow + 两个 Agent Builder 智能体)位于 [uipath/gauntlet/](uipath/gauntlet/) 中。该文件夹包含解决方案清单 (`gauntlet.uipx`) 以及每个项目。你需要将文件夹**打包**为可部署的 `.zip` 文件,**发布**该 `.zip` 文件,然后对其进行**部署**: ``` cd uipath/gauntlet # 1. 将 solution 文件夹(包含 gauntlet.uipx)打包为 ./dist 下的 .zip uip solution pack . ./dist -n gauntlet -v 1.0.0 # pack 会打印其写入的 .zip 确切路径;在下一步中使用该路径 # 2. 将打包好的 .zip 发布到 UiPath solution feed uip solution publish ./dist/gauntlet_1.0.0.zip # 3. 部署它。创建 Orchestrator 文件夹,配置资源并激活 uip solution deploy run --name gauntlet \ --package-name gauntlet --package-version 1.0.0 \ --folder-name Gauntlet --parent-folder-path Shared # (使用以下命令查找已发布的包名/版本:uip solution packages list) ``` 这将部署: - `FightArena` (Maestro Case) - `RoundOrchestrator` (Maestro Flow) - `MetroBankCSR` (Agent Builder 智能体,即蓝队目标) - `RefereeAgent` (Agent Builder 智能体,即裁判) ### 5. 部署 Coded App (`gauntletapp`) ``` cd uipath/gauntlet-console npm install npm run build # produces dist/ uip codedapp pack dist -n gauntletapp -v 1.0.0 # pack dist/ into a .nupkg uip codedapp publish --name gauntletapp # register the package in your tenant uip codedapp deploy --name gauntletapp # deploy / upgrade the app ``` 这会将 `gauntletapp` 发布并部署到你的租户。从 UiPath Automation Cloud 的 **Apps** 标签页中打开它。 ### 6. 运行演示工作流 一切部署就绪后: 1. 在你的 UiPath 租户中**打开 `gauntletapp`**。 2. 在 **Dashboard** 上,点击 *Run a fight*。选择一个红队角色(例如 `aggressive-lawyer`)、一个场景以及蓝队姿态。点击 **Replay this fight**。 3. 从侧边栏打开 **Coach Lab**。将你的 LLM API key 粘贴到模态框中(保留在 `sessionStorage` 中,从不发送到 Gauntlet 服务器)。点击 **Run live (add key)**。教练会在你面前发明出一个新的攻击角色。 4. 在 **Defend** 标签页上,打开任何一场失败的对战。**Fix Recommender** 已经起草好了一份补丁。点击 **File to Action Center**,在你的租户中创建一个真实的 Action Center 任务。 5. 浏览 **Audit** 标签页以查看 OWASP LLM Top-10 / MITRE ATLAS 的覆盖率,并在 **Logs** 中查看记录在案的 75 场完整对战库。 ### 本地开发 要在本地针对你的租户运行 Coded App(无需重新部署): ``` cd uipath/gauntlet-console npm run dev # → http://localhost:5173 ``` 该应用在未通过身份验证时会回退到内置的离线语料库,因此评委也可以在不需要租户的情况下检查每一个屏幕。 ## 定位 Gauntlet 是 **UiPath Agent Evaluations 的对抗性补充**。Agent Evaluations 根据静态规则为你的智能体打分,而 Gauntlet 则是根据一个试图主动破坏它的对手来打分,并将每一次成功的攻击转化为永久性的测试用例。 端到端均使用智能体编码工具构建。这在主题上非常契合:一个构建工具以确保其他智能体保持诚实的智能体。 ## 仓库布局 ``` . ├── src/gauntlet/ Python package (Coach, Fix, Referee, Runner, CLI) ├── uipath/ │ ├── gauntlet/ UiPath solution │ │ ├── FightArena/ Maestro Case │ │ ├── RoundOrchestrator/ Maestro Flow │ │ ├── MetroBankCSR/ Agent Builder agent (Blue target) │ │ └── RefereeAgent/ Agent Builder agent (judge) │ └── gauntlet-console/ React Coded App (`gauntletapp`) ├── personas/ Red attack persona library (8 YAML personas) ├── scenarios/ Fight scenarios (15 YAML scenarios) ├── scripts/ Test Manager import helper └── docs/ ├── ARCHITECTURE.md Detailed system architecture ├── PERSONAS.md Red-team persona reference └── screenshots/ In-app screenshots referenced above ``` ## 开源许可 采用 **MIT License** 授权,这是 UiPath AgentHack 2026 规则允许的两种开源许可(MIT 或 Apache 2.0)之一。请参阅 [LICENSE](LICENSE)。 ## 提交要求 (AgentHack 2026) 各项必要元素所在的位置,方便评委一目了然地进行核实: | 要求 | 状态 | 章节 | |---|---|---| | 包含所有项目文件的公开 GitHub 仓库 | ✅ | [github.com/tdries/uipath-hackathon-gauntlet](https://github.com/tdries/uipath-hackathon-gauntlet) | | 项目的功能 | ✅ | [项目描述](#project-description) | | 使用的 UiPath 组件 | ✅ | [使用的 UiPath 组件](#uipath-components-used) | | Coded agents、低代码 Agent Builder 或两者的结合 | ✅ 两者结合 | [智能体类型](#agent-type) | | 前置条件 | ✅ | [前置条件](#prerequisites) | | 设置说明 | ✅ | [设置说明](#setup-instructions-for-judging) | | MIT 或 Apache 2.0 许可 | ✅ MIT | [开源许可](#license) |
标签:AI智能体, RPA自动化, 域名收集, 提示注入, 红队评估, 自动化攻击, 逆向工具, 集群管理