Skip to content

Add experimental browser CDP tools without a bundled spec#1163

Open
threepointone wants to merge 4 commits intomainfrom
browser
Open

Add experimental browser CDP tools without a bundled spec#1163
threepointone wants to merge 4 commits intomainfrom
browser

Conversation

@threepointone
Copy link
Copy Markdown
Contributor

@threepointone threepointone commented Mar 23, 2026

Summary

  • Add experimental browser CDP tools for the Agents SDK.
  • Remove the bundled CDP spec and fetch the live protocol from Browser Rendering instead.
  • Make local development work through Browser Rendering in wrangler dev, without a separate Chrome process.

What Changed

  • browser_search now fetches the live protocol from the Browser Rendering devtools endpoints, normalizes it into the tool-facing search shape, and caches it briefly in memory.
  • browser_execute now connects through the Browser Rendering devtools WebSocket endpoint and cleans up sessions with the corresponding DELETE endpoint.
  • Delete the generated CDP spec assets and the build-cdp-spec build step.
  • Add Wrangler-backed browser e2e tests that start a real wrangler dev instance and exercise simple search and execution scenarios.
  • Update the ai-chat example to use the Browser Rendering binding directly in local development.
  • Add a design doc and refresh the usage doc.

Testing

  • npm run test:browser
  • WRANGLER_PACKAGE=wrangler@latest npm run test:browser
  • npm run -w agents build

Notes

  • The repo-pinned Wrangler version is bumped to 4.81.1 because the previous pin (4.77.0) did not support the local Browser Rendering devtools path used by these tests.
  • Local browser development no longer requires CDP_BASE_URL or a separately managed Chrome process.
  • The new docs are in docs/browse-the-web.md and design/browser-tools.md.

Introduce experimental "Browse the Web" browser tools that expose Chrome DevTools Protocol (CDP) access (browser_search and browser_execute). Adds documentation, an examples/ai-chat integration (env types, wrangler config, start script, server & UI updates), a CDP spec build script (scripts/build-cdp-spec.ts) that generates spec data, new browser package exports and build targets, and end-to-end browser tests with Vitest. Also updates .gitignore and package metadata to include new optional dependencies and test scripts. This enables agents to run sandboxed JS that queries the CDP spec and executes CDP commands against a host browser for scraping, inspection, and debugging.
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 23, 2026

🦋 Changeset detected

Latest commit: 3163cda

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
agents Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 23, 2026

Open in StackBlitz

agents

npm i https://pkg.pr.new/agents@1163

@cloudflare/ai-chat

npm i https://pkg.pr.new/@cloudflare/ai-chat@1163

@cloudflare/codemode

npm i https://pkg.pr.new/@cloudflare/codemode@1163

hono-agents

npm i https://pkg.pr.new/hono-agents@1163

@cloudflare/shell

npm i https://pkg.pr.new/@cloudflare/shell@1163

@cloudflare/think

npm i https://pkg.pr.new/@cloudflare/think@1163

@cloudflare/voice

npm i https://pkg.pr.new/@cloudflare/voice@1163

@cloudflare/worker-bundler

npm i https://pkg.pr.new/@cloudflare/worker-bundler@1163

commit: 3163cda

jonnyparris added a commit to jonnyparris/dodo that referenced this pull request Apr 8, 2026
Replace the single browser_navigate tool (text extraction only) with two
code-mode tools that give sessions full CDP access:

- browser_search: query the ~1.7MB CDP spec server-side (56 domains,
  664 commands, 237 events). The spec never enters the context window.
- browser_execute: run CDP commands against a live headless Chrome via
  WebSocket. Screenshots, DOM manipulation, network interception, etc.

Uses Dodo's existing DynamicWorkerExecutor + BROWSER binding. The LLM
writes JS that executes in a sandbox with a cdp helper (send, attachToTarget,
getDebugLog). Adapted from cloudflare/agents#1163.

Also:
- Remove @cloudflare/puppeteer dependency (no longer needed)
- Update system prompt with CDP usage patterns
- Fix stale MCP catalog test (sentry entry was removed)
@whoiskatrin whoiskatrin changed the title DO NOT MERGE — Experimental browser CDP tools for Agents SDK Add experimental browser CDP tools without a bundled spec Apr 12, 2026
@whoiskatrin whoiskatrin marked this pull request as ready for review April 12, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants