Menu
Cloudflare Blog·November 13, 2026

Designing a Serverless Browser Engine for AI Agents on Cloudflare Workers

Cloudflare open-sourced Kitesurf, a stateless, containerless browser engine built on Cloudflare Workers to power AI agents. This architectural deep-dive examines how running browser rendering, HTML parsing via Blitz, and WebAssembly-compiled JavaScript runtimes on edge infrastructure reduces resource overhead compared to traditional Chromium containers.

Read original on Cloudflare Blog

Architectural Overview of Serverless Browsers

Traditional browser automation relies on heavy containerized instances of Chromium running on dedicated virtual machines. This approach introduces significant CPU and memory overhead, limiting scalability and increasing costs when provisioning concurrent instances for AI agents. Kitesurf bypasses the traditional container model by executing entirely within Cloudflare Workers edge infrastructure, utilizing stateless execution environments that scale on demand.

Core Components and WebAssembly Stack

To achieve browser-like capabilities without a full browser binary, Kitesurf stitches together a modular ecosystem of open-source Rust libraries compiled to WebAssembly. This separation of concerns allows fine-grained execution scaling across the edge worker runtime.

  • Blitz: Handles HTML parsing, the Document Object Model (DOM), layout, and visual painting.
  • Stylo: Manages CSS parsing, cascading, and computed styles.
  • Boa: Executes page JavaScript inside WebAssembly as a fallback runtime layer.
  • Linebender & Krilla: Provide text layout, 2D graphics rendering, and PDF generation capabilities.

Client Integration via Chrome DevTools Protocol

Despite running on a distributed edge network rather than a local instance, Kitesurf natively supports the Chrome DevTools Protocol (CDP). This allows standard automation harnesses and AI agent frameworks (such as Puppeteer) to connect via WebSockets, capturing screenshots, executing programmatic commands, and interacting with pages seamlessly.

ℹ️

Architectural Trade-Off

While edge-based serverless rendering dramatically reduces resource consumption and spin-up latency compared to containerized browsers, running complex layouts and JavaScript engines like Boa inside WebAssembly introduces CPU constraints that require careful optimization for heavily dynamic web applications.

browser automationedge computingcloudflare workerswebassemblyai agentsserverless architecture

Comments

Loading comments...

Want the fundamentals behind stories like this? Take the free System Design Academy course with certificate.