Mingyu's Library主页
AI Daily · 2026-08-09 · 深度学习AI Daily · 2026-08-09 · Deep dive

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.

为什么值得读:Agent 上网(读文档、抓页面、截图、填表)越来越多,而人用的浏览器为画面和交互优化,Agent 关心的却是 token、并发、成本和隔离。Kitesurf 是第一个由大型云厂商推出、从零写起的「Agent 优先」浏览器引擎,它把这些取舍摆在了台面上——理解它,就能判断你的 Agent 什么时候该用轻量引擎、什么时候必须用完整 Chromium。
Why read this: agents browse more and more (reading docs, scraping, screenshots, forms), yet human browsers optimize for pixels and interaction while agents care about tokens, concurrency, cost and isolation. Kitesurf is the first from-scratch, agent-first browser engine from a major cloud vendor, and it puts these trade-offs on the table. Understanding it tells you when your agent can use a lightweight engine and when it needs full Chromium.

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

Kitesurf 的四个部件(全部跑在 Cloudflare Workers 上)你的 AgentPuppeteer / Playwright或 chrome-devtools-mcpEngine唯一对外:CDP WebSocket + REST保存会话状态PageScript(每页一个 isolate)Blitz/Stylo 解析 HTML/CSS跑 script 与 wasm;eval 用 BoaPageRenderer(无状态)renderFrame() → PNG卡住就杀掉重启SandboxOutbound唯一能出网:CORS、浏览器式请求头每页独立 cookie;违规返回 403互联网每次加载都当作不可信输入失败规则:任何错误只退化为空白帧或缺失元素,绝不让会话崩掉作者据 Cloudflare 官方博客(2026-08-06)绘制,非官方架构图
图 1 · Kitesurf 的组件与数据流(作者据官方博客绘制)
Kitesurf’s four parts (all running on Cloudflare Workers)Your agentPuppeteer / Playwrightor chrome-devtools-mcpEngineOnly public part: CDP WS + RESTholds session statePageScript (one isolate/page)Blitz/Stylo parse HTML/CSSruns scripts & wasm; eval via BoaPageRenderer (stateless)renderFrame() → PNGkilled and relaunched if stuckSandboxOutboundOnly network access: CORS, browser headerscookie jar per page; 403 on policy failInternetevery load treated as untrustedFailure rule: any error degrades to a blank frame or missing element, never a dead sessionDrawn by the author from Cloudflare’s blog post (2026-08-06); not an official diagram
Figure 1 · Kitesurf’s components and data flow (author’s sketch from the official blog)
  1. Engine:唯一对外的部件,处理 CDP WebSocket 和 HTTP REST API,并保存会话状态;其余部件都是无状态的。
  2. PageScript:每个页面(或跨进程 iframe)一个长期存活的 isolate,用 Dynamic Workers 创建;借用 Rust 写的 Blitz 与 Stylo 解析 HTML 和 CSS,页面里的 <script> 与 .wasm 在同一个 isolate 里运行。Workers 原生不支持 eval,所以暂用 Rust 写的 JS 引擎 Boa 兜底,原生支持到来后会去掉。
  3. PageRenderer:拿到 PageScript 产出的页面「场景」,从静态资源取字体和图片,用 blitz-paint(文字排版用 Parley)光栅化;Engine 通过一次 renderFrame() RPC 拿回 PNG。它不持有页面状态,所以卡住或失败时可以直接杀掉重启。
  4. SandboxOutbound:唯一能访问网络的部件,由 Dynamic Workers 强制保证;负责 CORS、注入「像浏览器」的请求头、过滤响应,并给每个页面单独的 cookie 罐;不符合策略的请求直接返回 403。
  1. Engine: the only public-facing part. It handles the CDP WebSocket and HTTP REST APIs and stores session state; everything else is stateless.
  2. 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 .wasm in the same isolate. Workers lacks native eval, so Boa, a Rust JS engine, fills in until native support arrives.
  3. 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.
  4. 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

Kitesurf ÷ Chromium(热池),虚线 = Chromium 水平(100)Chromium = 100CPU · 截图380 vs 1,173 msCPU · 提取 HTML229 vs 877 ms内存 · 截图57.8 vs 271.0 MiB内存 · 提取 HTML39.4 vs 273.7 MiB耗时 · 截图1,148 vs 637 ms耗时 · 提取 HTML820 vs 472 ms数据:Cloudflare 自测,14 个 URL、5 次运行中位数;越短越省,超过虚线表示更慢
图 2 · Kitesurf 与热池 Chromium 的相对资源与耗时(数据来自 Cloudflare 博客,作者换算为百分比绘图)
Kitesurf ÷ Chromium (warm pool); dashed line = Chromium (100)Chromium = 100CPU · screenshot380 vs 1,173 msCPU · HTML extract229 vs 877 msMemory · screenshot57.8 vs 271.0 MiBMemory · HTML extract39.4 vs 273.7 MiBWall time · screenshot1,148 vs 637 msWall time · HTML extract820 vs 472 msCloudflare’s own test: 14 URLs, median of 5 runs. Shorter = cheaper; past the line = slower
Figure 2 · Kitesurf vs warm-pool Chromium, relative resources and time (Cloudflare’s data, converted to percentages by the author)
3.1–3.8×CPU 更省
(截图 / 提取 HTML)
4.7–7.0×内存更省
1.7–1.8×单次耗时更慢
14 × 5测试规模:14 个 URL,
每项 5 次取中位数
3.1–3.8×less CPU
(screenshot / HTML extract)
4.7–7.0×less memory
1.7–1.8×slower wall time
14 × 5test size: 14 URLs,
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.

读数注意(第三方 eesel 08-24 的分析):① 对比的是「热池」Chromium 与每次冷启动的 Kitesurf,且 14 个 URL 多为文字为主的页面,不代表结账流程这类复杂负载;② Browser Run 按浏览器时长和并发浏览器数计费(付费档每月含 10 小时,超出 $0.09/小时),而不是按 CPU 或内存,所以在 Kitesurf 有单独价格之前,省下的资源主要落在 Cloudflare 一侧,而更长的耗时反而按时长计费;③ Kitesurf 目前 beta 免费,有每账号额度,正式价格未公布。
Caveats (from a third-party analysis by eesel, 08-24): (1) the comparison pits a warm Chromium pool against a cold Kitesurf render each time, and the 14 URLs are mostly text-heavy, unlike checkout flows; (2) Browser Run bills browser hours and concurrent browsers (paid plan: 10 hours included per month, then $0.09/hour), not CPU or memory, so until Kitesurf gets its own rate the savings mostly land on Cloudflare’s side, while the longer wall time is what you are billed for; (3) Kitesurf is free in beta behind per-account limits, with GA pricing unpublished.

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
上手顺序建议(作者观点):先把你最常访问的 10 个页面丢进官方 playground(kitesurf.cloudflare.app)或 Quick Actions 看能否正常渲染;能的走 Kitesurf 跑批量读取,不能的(登录态、强反爬、WebGL)留在 Chromium。同一套 CDP 代码只差一个查询参数,很适合按站点路由。
Suggested order (author’s view): first run your 10 most-visited pages through the official playground (kitesurf.cloudflare.app) or Quick Actions to see if they render; route the ones that work to Kitesurf for bulk reading and keep the rest (logins, strict bot checks, WebGL) on Chromium. The same CDP code differs by one query parameter, which makes per-site routing easy.

6横向对比:四种给 Agent 的浏览方式

6Comparison: four ways to give agents a browser

KitesurfBrowser Run 默认(Chromium)LightpandaPlaywright MCP(本地)
引擎从零写起,Rust 编译为 wasm,跑在 V8 isolate完整 Chromium从零写起,Zig本地 Chromium / Firefox / WebKit
能否截图/渲染能(软件渲染,保真度较低)能,保真度最高不做图形渲染能;但推荐用可访问性快照驱动操作
接口CDP、REST Quick ActionsCDP、RESTCDP(Puppeteer / Playwright)MCP 工具
公开数据CPU 省 3.1–3.8×、内存省 4.7–7×、慢 1.7–1.8×(厂商自测)基准线约 9× 快、内存约 16× 少(厂商自测,爬取场景)未给性能数字
适合大量一次性公开页面读取、截图、PDF登录态、视频/WebGL、复杂交互不需要画面的大规模爬取开发时让编码 Agent 操作本地页面
部署托管(beta 免费),计划开源托管,按时长与并发计费开源自部署或其云服务本地运行
KitesurfBrowser Run default (Chromium)LightpandaPlaywright MCP (local)
EngineFrom scratch, Rust compiled to wasm, in V8 isolatesFull ChromiumFrom scratch, ZigLocal Chromium / Firefox / WebKit
Screenshots / renderingYes (software, lower fidelity)Yes, highest fidelityNo graphical renderingYes, but actions are driven by accessibility snapshots
InterfaceCDP, REST Quick ActionsCDP, RESTCDP (Puppeteer / Playwright)MCP tools
Published data3.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 forBulk one-shot public-page reads, screenshots, PDFsLogins, video/WebGL, complex interactionLarge crawls that need no pixelsLetting a coding agent drive local pages during development
DeploymentManaged (free in beta), open source plannedManaged, billed by hours and concurrencyOpen source self-host or its cloudRuns 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

坑 1:它不是万能浏览器。官方明确列出暂不适合:播放视频、渲染 WebGL、需要真实 TLS 指纹的反爬挑战、需要持久状态的长时间登录会话——这些请用 Browser Run 默认的 Chromium。WPT 通过率高也不等于你要的网站都能正常工作,先测再切。
Pitfall 1: it isn’t a universal browser. Cloudflare lists what it isn’t ready for: video, WebGL, bot challenges that check real TLS fingerprints, and long authenticated sessions that need persistent state. Use Browser Run’s default Chromium for those. A high WPT pass count doesn’t mean your target sites work; test before switching.
坑 2:隔离 ≠ 防提示注入。isolate 和出网沙箱限制的是页面代码能做什么,不限制页面内容能说服你的 Agent 做什么(eesel 的分析也指出了这一点)。Agent 读回的文本仍要当作不可信输入处理,写操作仍要有权限把关。
Pitfall 2: isolation ≠ prompt-injection defense. Isolates and the outbound sandbox limit what page code can do, not what page content can persuade your agent to do (eesel’s analysis makes the same point). Text the agent reads back is still untrusted input, and write actions still need permission gating.
坑 3:别指望「像真人」。据 eesel 引述,Cloudflare 的 Celso Martinho 在 Hacker News 上表示 Browser Run 的流量始终被标识为机器人流量;需要伪装成人的场景不是它的目标。坑 4:省资源 ≠ 省钱(暂时)——计费按时长,更慢反而可能更贵,见第 4 节。坑 5:「开源」还只是计划——博客说「准备好后」开源,未给时间和许可证。
Pitfall 3: don’t expect to look human. Per eesel, Cloudflare’s Celso Martinho said on Hacker News that Browser Run traffic is always identified as bot traffic; looking human isn’t the goal. Pitfall 4: fewer resources ≠ lower bill (for now): billing is by time, so slower can cost more; see section 4. Pitfall 5: “open source” is still a plan: the blog says “once we’re ready,” with no date or license.

8资源与来源

8Resources and sources