browse-the-web.md
attributes
| source_path | references/browse-the-web.md |
|---|---|
| source_sha256 | c78beb4ce000b40284f7fc90988471d06ac4db3c553878f29cc3276bbbfecfeb |
| source_url | https://github.com/cloudflare/skills/blob/47dfc2ce969bf62acf8bc231198ade4bb02712e0/skills/agents-sdk/references/browse-the-web.md |
| supporting_skill_id | 40176 |
| upstream_revision | 47dfc2ce969bf62acf8bc231198ade4bb02712e0 |
Browse the Web (Experimental)
Fetch https://developers.cloudflare.com/agents/tools/browser/index.md for complete documentation.
CDP-powered browser tools that let agents scrape, screenshot, and interact with web pages.
Setup
// wrangler.jsonc
{
"browser": { "binding": "BROWSER" },
"worker_loaders": [{ "binding": "LOADER" }],
"compatibility_flags": ["nodejs_compat"]
}
Usage with AI SDK
import { createBrowserTools } from "agents/browser/ai";
export class MyAgent extends AIChatAgent<Env> {
async onChatMessage(onFinish) {
const browserTools = createBrowserTools({
browser: this.env.BROWSER,
loader: this.env.LOADER
});
const result = streamText({
model: openai("gpt-4o"),
messages: await convertToModelMessages(this.messages),
tools: { ...myTools, ...browserTools },
onFinish
});
return result.toUIMessageStreamResponse();
}
}
Available Tools
| Tool | Purpose |
|---|---|
browser_search |
Search the web and return results |
browser_execute |
Navigate to URL, execute JS, return results |
The LLM writes async JavaScript IIFEs that run in a fresh browser session.
When to Use
- Need a real browser (JS rendering, screenshots, interaction) → browser tools
- Just need HTML/API data → use
fetch()instead (faster, cheaper)
Low-Level API
import { connectBrowser, CdpSession } from "agents/browser";
const browser = await connectBrowser(this.env.BROWSER);
const cdp = new CdpSession(browser);
await cdp.send("Page.navigate", { url: "https://example.com" });
Children
No children yet.
Like how this is organised?
Build your own Memory tree on knowen.md: notes, decisions and tasks in one connected markdown graph, shared with your team and your AI agents.