Skip to main content
Glama
rycerzes

brightdata-gatekeeper

by rycerzes

brightdata-gatekeeper

基于证据的 Bright Data Scraper Studio 自愈审批。

Bright Data 能修复损坏的爬虫,但它不会判断修复是否正确。 Gatekeeper 会——它检测故障、编写修复简报,然后根据爬虫健康时记录的行来评判提议的修复方案,如果两者不一致则拒绝。

仪表盘

https://gatekeeper.rycerz.es

变异目标

https://recalls.rycerz.es

演练

docs/DEMO.md

演示视频

video/out/gatekeeper-demo.mp4 — 83 秒,由 HTML 生成,非屏幕录制

它填补的空白

Bright Data 自己的 CLI 文档说得很直白:

你是检测器。 CLI 永远不会自行判断爬虫是否损坏——你需要检查运行输出并做出判断。[…] 模糊的提示会产生模糊的修复。

scraper heal 会重写采集器的模板,并在审批门处停下。approve 提交它。--auto-approve 跳过提问。没有人检查答案。

Bright Data 提供

Gatekeeper 新增

scraper run

检测器 — 捕获仍返回 HTTP 200 的故障

scraper heal "<prompt>"

简报生成器 — 携带诊断结果的类型化字段列表

审批门、approve、--reject

审批器 — 根据黄金行评判预览

run → validate → diagnose → brief → heal → verify → approve or reject → re-brief

这个循环也无法从其他任何地方触达。Bright Data 的 Python SDK 覆盖了 Scraper Studio 的触发/轮询/获取,但不包括 heal 或 approve;其包含 69 个工具的 MCP 服务器完全没有 Scraper Studio 工具。Gatekeeper 自带 MCP 服务器,因此智能体可以驱动它。

Related MCP server: scraper-health-mcp

关键结果

针对一个故意损坏页面上的在线采集器,Bright Data 的 heal 正确恢复了四个字段,却默默将第五个字段降为 null。units 被声明为可选,因此所有 schema、类型和范围检查都通过了——零故障发现:

--auto-approve would : APPROVE   preview passes every field check
gatekeeper decided   : REJECT    2/2 golden rows disagree
                                 units: expected '118500', preview has 'null'

--auto-approve 本会提交一个悄悄停止收集单位计数的爬虫。拒绝原因进入了下一份简报,重试在每一行比较中都与黄金行匹配,修复在全新的一次在线运行中得到了验证。

快速开始

uv sync --all-extras
npm install -g @brightdata/cli        # Node >= 20
cp .env.example .env                  # add BRIGHTDATA_API_KEY

gatekeeper doctor                     # check the setup
gatekeeper spec add specs/mutant-recalls.json
gatekeeper status                     # survey every collector
gatekeeper check   <collector_id>     # detect
gatekeeper golden  <collector_id>     # record known-good rows
gatekeeper heal    <collector_id>     # run the loop
gatekeeper history <collector_id>     # why a fix was committed or rejected
gatekeeper serve                      # dashboard on :8000

作为 MCP 服务器,智能体可以驱动这个循环:

claude mcp add gatekeeper -- gatekeeper mcp

preview_heal_brief 显示将要发送的提示,而无需消耗 AI-Flow 任务。

循环遵循的规则

  • 永远不要相信退出码。 返回 200 但字段为空的运行才是真正需要关注的故障。

  • 永远不要修复阻塞。 blocked 和 dead_page 会发出警报,但不是布局变更。

  • 没有证据就不要批准。 没有黄金行意味着弃权,而不是批准。

  • 提交后必须验证。 预览是承诺;在线运行才是证据。

采集器

四个受管采集器,其中三个是真实网站,均不在 Bright Data 的 1,743 个预构建爬虫中——gatekeeper coverage <url> 会检查这一点,而不是断言。

采集器

目标

行数

值得注意的

mutant-recalls

recalls.rycerz.es

8

按需故障;五种布局,值相同

arxiv-cs-lg

arxiv.org

950

身份稳定,因此黄金行能经受变动

hn-front-page

news.ycombinator.com

59

嵌套输出,通过 row_path 展平

lobsters

lobste.rs

125

到达时已损坏:114 行,每个字段都缺失

详细信息,包括黄金行引导问题:docs/SITES.md。

布局

src/gatekeeper/
  detector/    rules, baselines, engine — decides a scraper broke
  brief/       diagnosis → typed heal prompt
  approver/    judges a preview against golden rows
  brightdata/  bdata CLI wrapper, envelopes, coverage check
  controller   the closed loop
  mcp          agent-callable tools
  api, static  the dashboard
mutant/        the mutation target, deployed as a Worker

测试

$ pytest -q
138 passed

无网络、无积分:bdata CLI 在子进程边界被桩替换,循环针对脚本化客户端运行,因此整个状态机——包括拒绝与重新收敛——都在离线状态下得到验证。

备注

部署,以及仪表盘如何无需凭据发布:docs/DEPLOY.md。在线 API 教会我们而文档没有的内容:docs/FINDINGS.md。

MIT.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    C
    maintenance
    Enables agents to resolve data incidents by preparing remediation, inspecting verification results, and staging for human approval, while integrating with DataHub for evidence.
    5
    Apache 2.0
  • A
    license
    A
    quality
    A
    maintenance
    Enables coding agents to independently verify web changes by scanning pages, inspecting UI structure, generating Playwright reproductions, and executing tests with structured QA evidence.
    4
    59 npm
    3
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Enables AI coding agents to diagnose and repair Python Selenium UI automation using real evidence from live DOM and test runs, with enforced safety boundaries and verifiable fixes.
    2
    MIT