Kitesurf 现已开源

我们在 8 月推出了 Kitesurf——这是我们面向 AI 智能体的无状态浏览器,完全运行在 Workers 之上——并在 9 月跟进加入了 WebMCP 支持、新 API 以及更好的兼容性。每一次我们都提到,我们承诺将其开源,这样开发者如果愿意,就可以在自己的 Cloudflare 账户上运行自己的浏览器引擎。
这一承诺如今已经兑现。Kitesurf 已在 GitHub 上以 Apache 2.0 许可证开源。你可以阅读代码、在本地运行、修改它,并把你自己部署的实例发布到 Cloudflare Workers 上。
Kitesurf 完全运行在 Cloudflare Workers 上。它无需浏览器容器即可解析 HTML、应用 CSS、执行页面 JavaScript 并渲染截图。它支持 Chrome DevTools Protocol(CDP),因此你可以连接 Puppeteer 等客户端。
我们的主要目标是给 AI 智能体提供一个轻量、高效的浏览器——它能加载网站、执行 JavaScript 并与页面交互,同时相比 Chromium 这类完整浏览器占用更少的 CPU 和内存,并能在 Cloudflare 全球 Workers 网络上按需扩展。
Kitesurf 构建在 Cloudflare 的开发者平台和 API 之上,同时依托一个由编译为 WebAssembly 的开源 Rust 包组成的生态:
这些项目让 Kitesurf 得以实现。它们各自保留原有许可证;代码仓库的 NOTICE 文件记录了相关第三方声明。
Kitesurf 包含三个主要部分:Engine 管理浏览器会话和客户端连接,PageScript 运行页面及其 JavaScript,PageRenderer 负责绘制结果。
所有包、引擎、其 Rust 核心、DOM shim、渲染器以及 Kitesurf CLI 都分别存放在仓库 packages 目录下的各个文件夹中,你可以在那里了解各个部件是如何组合在一起的。
要在本地运行 Kitesurf,请遵循仓库的构建要求,然后克隆仓库、安装依赖并启动引擎:
git clone https://github.com/cloudflare/kitesurf.git cd kitesurf pnpm install --frozen-lockfile pnpm run dev 首次构建会编译 Rust 核心及其依赖,所以要给它一些时间。后续构建会复用构建缓存。最后,wrangler 会在 http://127.0.0.1:8787 启动一个本地开发服务器。打开该地址即可在 Chrome DevTools 中试运行某个页面,也可以以编程方式使用它。
你可以配合 NodeJS 脚本使用 puppeteer:
import puppeteer from "puppeteer-core"; const browser = await puppeteer.connect({ browserWSEndpoint: "ws://127.0.0.1:8787/devtools/browser", }); try { const page = await browser.newPage(); await page.goto("https://example.com/"); await page.screenshot({ path: "page.png" }); } finally { await browser.disconnect(); } 或者,你也可以把 AI harness 指向本地 CDP 端口(智能体们很喜欢 CDP),看着它完全接管 Kitesurf。
在本地完成修改和测试后,你可以把该引擎部署到自己的账户,并从那里使用 Kitesurf,而不必使用我们提供的 Browser Run 托管 API。请注意,这需要 Workers 付费计划,因为 Kitesurf 使用 Dynamic Workers 为各个页面创建隔离的 Worker。
在仓库根目录下:
pnpm run deploy 帮助我们把它做得更好 与我们所有开源项目一样,Kitesurf 托管在 Github 上,我们欢迎 fork 和贡献。不过请注意,Kitesurf 正处于密集开发阶段,我们当前的重点是让该引擎更兼容(可以看看 Web Platform Test 的演进)、更可靠、更高效。
如果你想贡献,请先看贡献指南。提交一个 issue,附上最小复现或提议方案,并在发起 pull request 之前获得维护者的背书。带有测试、明确证据和清晰范围的聚焦修复,比大规模重写或无关清理更容易审查,但所有贡献都不必是代码:一个能复现渲染 bug 的小页面、一个失败的自动化工作流,或一处清晰的文档更正,都能帮助我们向前推进。
Kitesurf 正在快速演进。请关注博客和更新日志中的更新,并留意官方落地页,以获取 Web Platform Tests 页面和基准测试中标准兼容性的最新信息。
也来 Discord 和团队聊聊吧。我们正在为智能体打造一款浏览器,非常希望你能帮助我们把它做得更好。
译文由英文原文机器翻译,术语按行业惯例统一,可在文末展开原文核对。
查看英文原文(Kitesurf is now open source)
We introduced Kitesurf, our stateless browser for AI agents that runs entirely on top of Workers, in August and followed up in September with WebMCP support, new APIs, and improved compatibility. On every occasion, we mentioned our commitment to open sourcing it so that developers could run their own browser engine on their own Cloudflare accounts if they want to.
That promise is now real. Kitesurf is open source on GitHub under the Apache 2.0 license. You can read the code, run it locally, change it, and deploy your own instance to Cloudflare Workers.
A browser built for agents
Kitesurf runs entirely on Cloudflare Workers. It parses HTML, applies CSS, executes page JavaScript, and renders screenshots without a browser container. It supports the Chrome DevTools Protocol (CDP), so you can connect clients such as Puppeteer.
Our main goal is to give AI agents a lightweight, efficient browser — one that can load websites, execute JavaScript, and interact with pages while using less CPU and memory than a full browser like Chromium, and scaling on demand across Cloudflare’s global Workers network.
Read more about why and how we built Kitesurf in our initial announcement and how to use it in Browser Run’s developer documentation.
What is inside the repository?
Kitesurf builds on Cloudflare’s Developer Platform and APIs, alongside an ecosystem of open-source Rust packages compiled to WebAssembly:
- Blitz provides HTML parsing, the DOM, layout, and painting.
- Stylo provides CSS parsing, cascading, and computed styles.
- Boa runs JavaScript inside WebAssembly (as the last resort only when we can’t run JavaScript in Dynamic Workers).
- Linebender libraries provide text layout and 2D graphics, and Krilla generates PDF output.
These projects made Kitesurf possible. They retain their respective licenses; the repository's NOTICE documents third-party notices.
Kitesurf has three main parts: the Engine manages browser sessions and client connections, PageScript runs the page and its JavaScript, and PageRenderer draws the result.
All packages, the engine, its Rust core, DOM shims, renderer, and Kitesurf CLI live separately in folders under the repository’s packages directory where you can explore how all the pieces fit together.
Run your own Kitesurf
To run Kitesurf locally, follow the repository's build requirements, then clone the repository, install dependencies, and start the engine:
git clone https://github.com/cloudflare/kitesurf.git
cd kitesurf
pnpm install --frozen-lockfile
pnpm run devThe first build compiles the Rust core and its dependencies, so give it some time. Subsequent builds reuse the build cache. Finally wrangler starts a local development server at http://127.0.0.1:8787. Open that address to try a page in Chrome DevTools, or use it programmatically.
You can use puppeteer with a NodeJS script:
import puppeteer from "puppeteer-core";
const browser = await puppeteer.connect({
browserWSEndpoint: "ws://127.0.0.1:8787/devtools/browser",
});
try {
const page = await browser.newPage();
await page.goto("https://example.com/");
await page.screenshot({ path: "page.png" });
} finally {
await browser.disconnect();
}Or you can point your AI harness at the local CDP port (agents love CDP) and watch it take full control of Kitesurf.
Deploy to your Cloudflare account
When you’re done changing and testing locally, you can deploy the engine to your own account and use Kitesurf from there instead of the Browser Run managed APIs we provide. Note that a Workers Paid plan is required because Kitesurf uses Dynamic Workers to create isolated Workers for pages.
From the repository root:
pnpm run deployHelp us make it better
As with all of our open-sourced projects, Kitesurf lives in Github and we welcome forks and contributions. However, note that Kitesurf is under heavy development and we are focusing on making the engine more compatible (check out Web Platform Test evolution), more reliable, and efficient.
Start with the contribution guidelines if you want to contribute. Open an issue with a minimal reproduction or a proposed approach, and get vouched by a maintainer before opening a pull request. Focused fixes with tests, clear evidence, and a well-defined scope are much easier to review than large rewrites or unrelated cleanup, but all contribution does not have to be code: a small page that reproduces a rendering bug, a failing automation workflow, or a clear documentation correction can help us move forward.
Stay tuned
Kitesurf is evolving quickly. Stay tuned for updates in the blog and our changelog, and keep an eye on the official landing page for the latest on standards compatibility in Web Platform Tests page and benchmarks.
And come chat with the team on Discord. We’re building a browser for agents, and we’d love your help making it better.
正文保留英文原文,标题与摘要由机器翻译。
原文发布于 Cloudflare Blog(Kitesurf is now open source),标题、摘要与正文由机器翻译,术语按行业惯例统一,未经人工逐句校订。