A self-hosted browser for AI agents is a public endpoint that will open any page and run any script for whoever reaches it. Cloudflare open-sourced Kitesurf, its browser engine for AI agents, this week, and its own changelog says the deployment has no lock: "Kitesurf does not provide built-in authentication." If your product has agents that browse, and running your own engine instead of a hosted service is now an option, this article covers what Cloudflare released, why the endpoint needs a gate, and a small Worker we would put in front of it before the first agent connects.
What Cloudflare released
Kitesurf is now on GitHub under the Apache 2.0 license. Per Cloudflare's changelog, dated November 12, it "runs entirely on Cloudflare Workers. It parses HTML, applies CSS, executes page JavaScript, and renders screenshots without a browser container." It speaks the Chrome DevTools Protocol (CDP), the same interface Puppeteer uses, so existing automation code can connect to it. You can run it locally with Wrangler or deploy it to your own account, which needs a Workers Paid plan because each page runs in its own Dynamic Worker.
Linuxiac's write-up adds how it is built: Blitz for HTML and layout, Stylo for CSS, page JavaScript mostly in Dynamic Workers "with the Boa JS engine as a WebAssembly-based fallback when required." Cloudflare calls the project experimental and "under heavy development", and Linuxiac notes it does not yet support every DevTools feature.
A CDP endpoint is remote control
CDP gives full control of the page. A client that connects can open any URL, run JavaScript in the page, read the result and take screenshots. That is exactly what your agent needs, and exactly what anyone else who finds the URL gets too. On your own deployment, their browsing comes from your account, counts against your plan and runs under your name.
Cloudflare is direct about it: "Protect your deployment with Cloudflare Access or another authentication layer." A hosted browser service puts that layer in front for you. When you deploy the engine yourself, the layer is yours to build, and the default state is open.
Put a gate in front
The engine should have no public address at all. In its Wrangler config, turn off the workers.dev route and give it no custom route, so the only way in is a service binding from a second Worker. That second Worker is the gate. A sketch of how we would write it:
// gate.ts: the only public way into the agent browser.
// A sketch. BROWSER is a service binding to the engine;
// AGENT_TOKEN is a secret only your agent runtime holds.
interface Env {
BROWSER: Fetcher;
AGENT_TOKEN: string;
}
async function same(a: string, b: string) {
const enc = new TextEncoder();
const [x, y] = await Promise.all([
crypto.subtle.digest("SHA-256", enc.encode(a)),
crypto.subtle.digest("SHA-256", enc.encode(b)),
]);
return crypto.subtle.timingSafeEqual(x, y);
}
export default {
async fetch(req: Request, env: Env) {
const auth = req.headers.get("Authorization") ?? "";
const token = auth.replace(/^Bearer /, "");
if (!token || !(await same(token, env.AGENT_TOKEN))) {
return new Response("forbidden", { status: 403 });
}
return env.BROWSER.fetch(req);
},
};
Notice that the token is compared by hashing both sides and using a timing-safe comparison, so response times don't leak how much of a guess was right, and that the gate forwards the whole request, WebSocket upgrade included, so Puppeteer connects through it unchanged. If you already use Cloudflare Access, an Access application with a service token does the same job without code; the point is that one of them exists before the engine is reachable.
What the gate doesn't cover
A token keeps strangers out. It does nothing about what your own agent does once inside. The pages it opens are untrusted input, and a page can carry instructions written for the model reading it. Keep the browsing agent's other tools narrow: it should not hold the keys that send email, move money or change records in the same run that reads arbitrary pages. Our AI agent guardrails page covers how we scope those tools.
Rotate the token like any other secret, and give each environment its own. Log every session the gate opens, with the time and the first URL, so unusual use shows up on a bill review instead of after it.
And weigh whether you need to self-host at all. Kitesurf is experimental and covers only part of CDP. If your agents need a browser that behaves like Chrome on every site, a hosted Chromium service will be more predictable today; self-hosting pays off when you want the engine's lower cost per page and are willing to own its gaps.
What to take from it
- Kitesurf is open source and deployable to your own Cloudflare account, and it ships with no authentication.
- A CDP endpoint lets whoever connects open pages and run scripts; on your deployment that happens on your account.
- Give the engine no public route, and put a gate Worker or Cloudflare Access in front before the first agent connects.
- The gate keeps others out; scoping your agent's own tools is a separate job.
If your agents browse the web and you want the browser, the gate and the agent's tool limits set up properly, book a conversation.
Sources
- Cloudflare Developers changelog, "Kitesurf is now open source", November 12, 2026: https://developers.cloudflare.com/changelog/post/2026-11-12-kitesurf-open-source/
- Linuxiac, "Cloudflare Open-Sources Kitesurf, Its Lightweight Browser Engine for AI Agents", November 14, 2026: https://linuxiac.com/cloudflare-open-sources-kitesurf-its-lightweight-browser-engine-for-ai-agents/



