Agent 专用浏览器 Kitesurf:为什么给 AI 用的浏览器要从零重写
Kitesurf, an Agent-First Browser: why a browser for AI gets rewritten from scratch
基于 Cloudflare 官方博客(2026-08-06)与 Browser Run 文档,并参考第三方分析与 Lightpanda、Playwright MCP 的公开资料整理。读完你会知道:Agent 为什么需要不同的浏览器、Kitesurf 怎么搭、数字该怎么读、怎么接进你的 Agent,以及它不适合什么。
Based on Cloudflare’s blog post (2026-08-06) and Browser Run docs, with a third-party analysis and public material on Lightpanda and Playwright MCP. You will learn why agents need a different browser, how Kitesurf is built, how to read its numbers, how to plug it into your agent, and what it is not for.
130 秒速览
1The 30-second version
一句话:Cloudflare 在 2026-08-06 发布了 Kitesurf——一个专门给 AI Agent 用、不基于 Chromium、整个跑在 Cloudflare Workers 上的浏览器。每个页面运行在一个隔离的 V8 isolate 里,兼容 Chrome DevTools Protocol(CDP),所以 Puppeteer、Playwright 代码只需在连接地址后加 browser=kitesurf。它的取舍很清楚:CPU 省 3 倍多、内存省 5–7 倍,但单次耗时慢约 1.7–1.8 倍,并且不支持视频、WebGL、长时间登录态。
In one sentence: on 2026-08-06 Cloudflare released Kitesurf, a browser built for AI agents, not based on Chromium, running entirely on Cloudflare Workers. Each page runs in its own V8 isolate, and it speaks the Chrome DevTools Protocol (CDP), so Puppeteer or Playwright code only needs browser=kitesurf added to the endpoint. The trade-off is explicit: over 3× less CPU and 5–7× less memory, but about 1.7–1.8× slower per task, with no video, WebGL or long logged-in sessions.
先说名词:无头浏览器是没有界面、由程序控制的浏览器;CDP 是 Chrome 的调试/控制协议,Puppeteer、Playwright 都靠它驱动浏览器;V8 isolate 是同一进程里彼此隔离的轻量 JavaScript 运行环境,Workers 就建立在它之上;MCP 是让 Agent 调用外部工具的协议。
Vocabulary first: a headless browser has no UI and is driven by a program; CDP is Chrome’s debugging/control protocol that Puppeteer and Playwright use; a V8 isolate is a lightweight, isolated JavaScript environment within a process, the foundation of Workers; MCP is the protocol agents use to call external tools.
2背景:Agent 为什么需要另一种浏览器
2Background: why agents need a different browser
Cloudflare 的论点是:人需要标签页、主题、扩展和像素级精确的渲染;Agent 需要的是为模型关心的东西优化——token 数、可扩展性、性能和成本,画面完美反而不那么重要。Agent 的上网负载也和人不同:大量一次性、突发的任务(打开一个页面、提取正文、截一张图、关掉),而不是一个人开着几十个标签页用一整天。
Cloudflare’s argument: humans want tabs, themes, extensions and pixel-perfect rendering; agents want a browser optimized for what models care about, namely token count, scalability, performance and cost, with visual perfection mattering less. Agent browsing load also differs: lots of one-shot, bursty tasks (open a page, extract text, take a screenshot, close) rather than one person keeping dozens of tabs open all day.
「让 Agent 少看像素」并不是 Kitesurf 首创。微软的 Playwright MCP 给模型的是结构化的可访问性快照(accessibility snapshot),README 说它「不需要视觉模型,纯靠结构化数据」;开源的 Lightpanda 用 Zig 从零写了一个不做图形渲染的无头浏览器,自称在 933 个真实页面的爬取测试中比 Chrome 快约 9 倍、峰值内存约 123MB 对 2GB(厂商自测)。Kitesurf 的不同点在于:它保留了渲染能力(能截图、生成 PDF),并且作为托管服务直接跑在 Cloudflare 网络上。
“Let agents look at fewer pixels” didn’t start with Kitesurf. Microsoft’s Playwright MCP gives models structured accessibility snapshots; its README says “No vision models needed, operates purely on structured data.” The open-source Lightpanda is a from-scratch headless browser in Zig with no graphical rendering, claiming about 9× faster than Chrome and ~123MB vs 2GB peak memory on a 933-page crawl (vendor-reported). Kitesurf differs by keeping rendering (screenshots, PDFs) and running as a managed service on Cloudflare’s network.
3架构:四个部件,只有一个能出网
3Architecture: four parts, only one touches the network
- Engine:唯一对外的部件,处理 CDP WebSocket 和 HTTP REST API,并保存会话状态;其余部件都是无状态的。
- PageScript:每个页面(或跨进程 iframe)一个长期存活的 isolate,用 Dynamic Workers 创建;借用 Rust 写的 Blitz 与 Stylo 解析 HTML 和 CSS,页面里的
<script>与.wasm在同一个 isolate 里运行。Workers 原生不支持eval,所以暂用 Rust 写的 JS 引擎 Boa 兜底,原生支持到来后会去掉。 - PageRenderer:拿到 PageScript 产出的页面「场景」,从静态资源取字体和图片,用 blitz-paint(文字排版用 Parley)光栅化;Engine 通过一次
renderFrame()RPC 拿回 PNG。它不持有页面状态,所以卡住或失败时可以直接杀掉重启。 - SandboxOutbound:唯一能访问网络的部件,由 Dynamic Workers 强制保证;负责 CORS、注入「像浏览器」的请求头、过滤响应,并给每个页面单独的 cookie 罐;不符合策略的请求直接返回 403。
- Engine: the only public-facing part. It handles the CDP WebSocket and HTTP REST APIs and stores session state; everything else is stateless.
- PageScript: one long-lived isolate per page (or out-of-process iframe), created with Dynamic Workers. It parses HTML and CSS with parts of the Rust projects Blitz and Stylo, and runs the page’s
<script>and.wasmin the same isolate. Workers lacks nativeeval, so Boa, a Rust JS engine, fills in until native support arrives. - PageRenderer: takes the page “scene” from PageScript, fetches fonts and images from static assets and rasterizes with blitz-paint (Parley for text shaping). The Engine gets a PNG back from a single
renderFrame()RPC. It holds no page state, so it can be killed and relaunched when stuck or failing. - SandboxOutbound: the only part that touches the network, enforced by Dynamic Workers. It handles CORS, injects browser-shaped headers, filters responses and keeps a separate cookie jar per page; requests that fail policy get a 403.
安全模型的出发点是「每次页面加载都是不可信输入,每个会话都从零开始」:每个部件只拿到它严格需要的权限,isolate 之间的隔离由平台提供,应用层再按同样原则切分。配套的失败规则是「任何失败只退化为空白帧或缺失元素,绝不让会话死掉」——对 Agent 来说,拿到一个不完美的结果往往好过整个任务中断。
The security model starts from “every page load is untrusted input, every session starts fresh”: each part gets only the access it strictly needs, the platform isolates the isolates, and the application layer is split on the same principle. The matching failure rule: “any failure degrades to a blank frame or a missing element, never a dead session.” For an agent, an imperfect result usually beats an aborted task.
兼容性怎么量?团队用 Web Platform Tests(WPT,浏览器厂商共用的标准符合性测试)跟踪:发布时通过约 21.5 万项,每周新增数百项;对 Agent 重要的 CSS、DOM、HTML、选区、SVG、XHR 覆盖较好,Streams 也基本可用。
How is compatibility measured? With Web Platform Tests (WPT, the shared conformance suite browser vendors use): about 215,000+ passing at launch, with hundreds more each week. Areas agents rely on (CSS, DOM, HTML, selection, SVG, XHR) are well covered, and Streams are decently supported.
4数字:省资源,但更慢
4The numbers: cheaper on resources, slower on the clock
(截图 / 提取 HTML)
每项 5 次取中位数
(screenshot / HTML extract)
median of 5 runs each
Cloudflare 把耗时差距主要归因于光栅化和 JPEG/PNG 编码(软件渲染,而不是 Chromium 的高度优化引擎)。它的论证是:CPU 和内存决定成本与容量,省下来就能在同样资源上跑更多并发会话,用一些画面保真度和单次速度去换。
Cloudflare attributes most of the wall-time gap to rasterization and JPEG/PNG encoding (software rendering instead of Chromium’s heavily optimized engine). Its argument: CPU and memory drive cost and capacity, so savings mean more concurrent sessions on the same resources, traded against some visual fidelity and per-task speed.
5怎么用:三种接法
5How to use it: three ways in
① 现有 Puppeteer / Playwright 代码:官方文档只给出端点格式——在 Browser Run 的 CDP 地址后加 browser=kitesurf。下面的连接代码是作者按这个端点改写的示例(Puppeteer 的 connect 与 Playwright 的 connectOverCDP 都支持自定义请求头),请以官方文档为准。
(1) Existing Puppeteer / Playwright code: the official docs give only the endpoint format: add browser=kitesurf to the Browser Run CDP URL. The connection code below is the author’s adaptation for that endpoint (both Puppeteer’s connect and Playwright’s connectOverCDP accept custom headers); defer to the official docs.
// 官方端点格式
wss://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/browser-run/devtools/browser?browser=kitesurf
// Puppeteer(作者示例)
import puppeteer from "puppeteer-core";
const browser = await puppeteer.connect({
browserWSEndpoint: WS_URL, // 上面的地址
headers: { Authorization: `Bearer ${process.env.CF_API_TOKEN}` },
});
const page = await browser.newPage();
await page.goto("https://example.com");
console.log(await page.$eval("h1", el => el.textContent));
await browser.close();
// Official endpoint format
wss://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/browser-run/devtools/browser?browser=kitesurf
// Puppeteer (author’s example)
import puppeteer from "puppeteer-core";
const browser = await puppeteer.connect({
browserWSEndpoint: WS_URL, // the URL above
headers: { Authorization: `Bearer ${process.env.CF_API_TOKEN}` },
});
const page = await browser.newPage();
await page.goto("https://example.com");
console.log(await page.$eval("h1", el => el.textContent));
await browser.close();
② 一次性 Quick Actions(REST):截图、提取内容、生成 PDF 这类单次任务最适合 Kitesurf,官方示例:
(2) One-shot Quick Actions (REST): single tasks like screenshots, content extraction and PDFs suit Kitesurf best. The official example:
curl -X POST 'https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/browser-run/screenshot?browser=kitesurf' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'Content-Type: application/json' \
-d '{ "url": "https://example.com" }' \
--output "screenshot.png"
curl -X POST 'https://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/browser-run/screenshot?browser=kitesurf' \
-H 'Authorization: Bearer <API_TOKEN>' \
-H 'Content-Type: application/json' \
-d '{ "url": "https://example.com" }' \
--output "screenshot.png"
③ 给编码 Agent 当 MCP 工具:Kitesurf 本身不是 MCP server;官方示例是用 Google 的 chrome-devtools-mcp 连到它的 CDP 端点(示例配置写给 Opencode)。在 Claude Code 里可以用同样的参数注册(作者改写):
(3) As an MCP tool for a coding agent: Kitesurf isn’t an MCP server itself; the official example points Google’s chrome-devtools-mcp at its CDP endpoint (the sample config targets Opencode). In Claude Code you can register the same arguments (author’s adaptation):
# Claude Code(作者据官方 Opencode 配置改写)
claude mcp add kitesurf -- npx -y chrome-devtools-mcp@latest \
--wsEndpoint="wss://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/browser-run/devtools/browser?browser=kitesurf" \
--wsHeaders='{"Authorization":"Bearer <API_TOKEN>"}'
# 对照:本地 Chromium + 可访问性快照(Playwright MCP 官方命令)
claude mcp add playwright npx @playwright/mcp@latest
# Claude Code (author’s adaptation of the official Opencode config)
claude mcp add kitesurf -- npx -y chrome-devtools-mcp@latest \
--wsEndpoint="wss://api.cloudflare.com/client/v4/accounts/<ACCOUNT_ID>/browser-run/devtools/browser?browser=kitesurf" \
--wsHeaders='{"Authorization":"Bearer <API_TOKEN>"}'
# For comparison: local Chromium + accessibility snapshots (official Playwright MCP command)
claude mcp add playwright npx @playwright/mcp@latest
6横向对比:四种给 Agent 的浏览方式
6Comparison: four ways to give agents a browser
| Kitesurf | Browser Run 默认(Chromium) | Lightpanda | Playwright MCP(本地) | |
|---|---|---|---|---|
| 引擎 | 从零写起,Rust 编译为 wasm,跑在 V8 isolate | 完整 Chromium | 从零写起,Zig | 本地 Chromium / Firefox / WebKit |
| 能否截图/渲染 | 能(软件渲染,保真度较低) | 能,保真度最高 | 不做图形渲染 | 能;但推荐用可访问性快照驱动操作 |
| 接口 | CDP、REST Quick Actions | CDP、REST | CDP(Puppeteer / Playwright) | MCP 工具 |
| 公开数据 | CPU 省 3.1–3.8×、内存省 4.7–7×、慢 1.7–1.8×(厂商自测) | 基准线 | 约 9× 快、内存约 16× 少(厂商自测,爬取场景) | 未给性能数字 |
| 适合 | 大量一次性公开页面读取、截图、PDF | 登录态、视频/WebGL、复杂交互 | 不需要画面的大规模爬取 | 开发时让编码 Agent 操作本地页面 |
| 部署 | 托管(beta 免费),计划开源 | 托管,按时长与并发计费 | 开源自部署或其云服务 | 本地运行 |
| Kitesurf | Browser Run default (Chromium) | Lightpanda | Playwright MCP (local) | |
|---|---|---|---|---|
| Engine | From scratch, Rust compiled to wasm, in V8 isolates | Full Chromium | From scratch, Zig | Local Chromium / Firefox / WebKit |
| Screenshots / rendering | Yes (software, lower fidelity) | Yes, highest fidelity | No graphical rendering | Yes, but actions are driven by accessibility snapshots |
| Interface | CDP, REST Quick Actions | CDP, REST | CDP (Puppeteer / Playwright) | MCP tools |
| Published data | 3.1–3.8× less CPU, 4.7–7× less memory, 1.7–1.8× slower (vendor test) | Baseline | ~9× faster, ~16× less memory (vendor test, crawling) | No performance figures |
| Best for | Bulk one-shot public-page reads, screenshots, PDFs | Logins, video/WebGL, complex interaction | Large crawls that need no pixels | Letting a coding agent drive local pages during development |
| Deployment | Managed (free in beta), open source planned | Managed, billed by hours and concurrency | Open source self-host or its cloud | Runs locally |
注意:表中三组性能数字来自各自厂商、各自场景,不能直接相互比较;Lightpanda 一列只基于其官网信息。
Note: the three sets of performance numbers come from different vendors and scenarios and can’t be compared directly; the Lightpanda column is based only on its website.
7坑与常见误解
7Pitfalls and misconceptions
8资源与来源
8Resources and sources
- Kitesurf 发布博客 — Cloudflare,2026-08-06 · 一手(性能数字为厂商自测)
- Browser Run · Kitesurf 文档 — 官方文档(端点、Quick Actions、MCP 配置)
- Browser Run 定价 — 官方文档
- eesel:Kitesurf 用速度换规模 — 2026-08-24 · 第三方分析(作者所在公司有自身产品立场)
- Lightpanda — 官网 · 厂商自述
- Playwright MCP — 微软 · 官方 README
- Developers Digest 08-08 日报 — 聚合 · 二手
- Kitesurf launch post — Cloudflare, 2026-08-06 · primary (vendor-run benchmarks)
- Browser Run · Kitesurf docs — official docs (endpoint, Quick Actions, MCP config)
- Browser Run pricing — official docs
- eesel: Kitesurf trades speed for scale — 2026-08-24 · third-party analysis (author’s company has its own product stance)
- Lightpanda — website · vendor claims
- Playwright MCP — Microsoft · official README
- Developers Digest, 08-08 brief — aggregator · secondary
主页