Software Engineering

Cloudflare open-sources Kitesurf, stateless Rust browser for AI agents on Workers

Key Takeaway

Cloudflare released Kitesurf under Apache 2.0, a browser engine built from Rust-to-WebAssembly components that runs entirely on Cloudflare Workers and exposes the Chrome DevTools Protocol for agent automation.

Summary

Cloudflare has open-sourced Kitesurf, its stateless browser engine designed specifically for AI agents, releasing the full codebase on GitHub under the Apache 2.0 license. The engine, first introduced in August, runs entirely on Cloudflare Workers without requiring a browser container, and now developers can run it locally, modify it, or deploy private instances to their own Cloudflare accounts.

Kitesurf parses HTML, applies CSS, executes JavaScript, and renders screenshots using a stack of Rust libraries compiled to WebAssembly: Blitz for DOM and layout, Stylo for CSS processing, Boa for JavaScript execution, Linebender for graphics, and Krilla for PDF generation. It exposes the Chrome DevTools Protocol (CDP), enabling compatibility with existing automation tools like Puppeteer and direct integration with AI agent harnesses.

Architecture and deployment model

  • Rust-to-WebAssembly stack: Kitesurf is built from modular Rust crates compiled to WebAssembly, with Blitz handling HTML parsing and DOM operations, Stylo managing CSS cascading and computed styles, and Boa executing JavaScript inside WASM as a fallback when Dynamic Workers cannot run JS directly.
  • Three-part engine design: The architecture separates concerns into the Engine (session and connection management), PageScript (page execution and JavaScript), and PageRenderer (drawing and output), with all components organized under a packages directory in the monorepo.
  • CDP compatibility: Full Chrome DevTools Protocol support allows existing tooling like Puppeteer to connect via WebSocket at ws://127.0.0.1:8787/devtools/browser, enabling screenshot capture, navigation, and programmatic control without modifying client code.
  • Dynamic Workers requirement: Production deployment to Cloudflare requires a Workers Paid plan because Kitesurf spins up isolated Dynamic Workers per page for sandboxed execution, with deployment handled through wrangler via pnpm run deploy.
  • Local development workflow: The repository uses pnpm with frozen lockfiles, compiles the Rust core on first build with subsequent cache reuse, and starts a local wrangler dev server at 127.0.0.1:8787 for testing before cloud deployment.

Why it matters

Kitesurf offers the open-source community a fully inspectable, self-hostable alternative to managed browser automation services, with particular relevance for developers building AI agents that need lightweight, scalable web interaction without the resource overhead of full Chromium instances. Its modular Rust architecture and WebAssembly target may also accelerate contributions to upstream projects like Blitz, Stylo, and Boa, while the CDP compatibility preserves existing investment in Puppeteer-based tooling across the Linux and cloud-native development landscape.

What to do

  • Clone the repository using 'git clone https://github.com/cloudflare/kitesurf.git'.
  • Install dependencies by running 'pnpm install --frozen-lockfile' in the directory.
  • Start the engine locally by running 'pnpm run dev'.
  • Use 'pnpm run deploy' to deploy to a Cloudflare account, noting that a Workers Paid plan is required for Dynamic Workers.

Original reference: blog.cloudflare.com →