The Cloudflare Agents SDK now ships with a browserTool that lets an agent launch a Browser Run instance, keep it alive across multiple turns, and return to the same tabs, cookies, and login state. This persistence removes the need to re‑authenticate or reconstruct page context for each interaction, which directly impacts how AI‑driven agents perform web‑based tasks.
New Persistent Browser Capability
When the browserTool is added to an agent’s toolset, the model generates code that drives the browser via the Chrome DevTools Protocol (CDP). Screenshots are emitted as image blobs that image‑capable models can analyse, and the UI can render them directly. The tool is only available with Agents SDK version 0.28.0 or later.
Architectural and Implementation Considerations
Integrating the tool requires three steps:
- Create a
Browserinstance backed bybrowserRun. - Register the instance in the object’s
Lifecycle. - Install the
browserToolin a Pi Durable extension registry before opening the harness.
A minimal JavaScript example looks like this:
import { Browser, browserRun } from "agents/browser";
import { browserTool } from "agents/browser/pi";
export class MyAgent extends DurableObject {
browser = new Browser({ provider: browserRun(this.env.BROWSER) });
harness = new PiHarness({
harness: async ({ storage, context }) => {
this.registry.install({
name: "browser",
tools: [browserTool({ ctx: this.ctx, browser: this.browser, loader: this.env.LOADER })]
});
return Harness.open(storage, { models, registry: this.registry });
}
});
}
Because the browser runs as a separate process managed by Browser Run, the agent’s lifecycle code must ensure the process stays alive for the duration of the conversation.
Operational and Security Implications
Persisting a browser session means cookies and authentication tokens remain in memory between turns. Practitioners should treat the browser instance as a stateful credential store and consider the following:
- Isolation: Ensure the browser process is scoped to a single agent instance to avoid cross‑agent data leakage.
- Session expiry: Monitor the lifetime of cookies; long‑lived sessions may outlive the intended use case.
- Resource usage: A live browser consumes CPU and memory; plan capacity accordingly, especially under high concurrency.
- Observability: Capture CDP logs and screenshot metadata to aid debugging and audit trails.
From a DevOps perspective, the new tool adds a dependency on the Browser Run service and the specific SDK version. Deployment pipelines should pin the SDK at ≥ 0.28.0 and verify that the runtime environment provides the required BROWSER and LOADER bindings.
Related CloudNinjas coverage: hands-on guides.
What This Means For Practitioners
Agents that need to interact with web pages can now maintain context without re‑login, simplifying workflows such as form filling, data extraction, or multi‑step navigation. Teams should audit existing agents for opportunities to replace ad‑hoc HTTP calls with the persistent browser, update SDK versions, and incorporate session‑management checks into their security reviews. Monitoring resource consumption and ensuring proper isolation will be key to scaling this capability safely.


