Conversation
ben-reitz
added this pull request to stack #2373
September 25, 2026 08:21
🦋 Changeset detectedLatest commit: da7f553 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
Contributor
🟡 agents import sizes: 1 entry point grew
Changed exports (5)
How this worksEach runtime export is bundled on its own, minified, and gzipped. Changes smaller than 100 B, or smaller than 1% and 1 KiB, are ignored. Growth over 10% or 5 KiB is marked 🔴. This report is informational and does not fail CI. The workflow artifact contains every measurement. Compared |
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
This was referenced Sep 25, 2026
ben-reitz
force-pushed
the
feat/browser-execute-tool
branch
from
September 25, 2026 09:13
29b86ec to
41a4c01
Compare
ben-reitz
force-pushed
the
feat/browser-execute-tool
branch
4 times, most recently
from
September 25, 2026 13:48
29740e1 to
f17efd9
Compare
ben-reitz
force-pushed
the
feat/browser-execute-tool
branch
from
September 25, 2026 13:57
f17efd9 to
08e8a34
Compare
createBrowserExecuteTool (agents/browser/ai) returns a browser_execute tool over BrowserSessionConnector, so model code drives one persistent host-named browser. Each session name gets its own codemode runtime. Results add restarted and newTabs from the connector's execution report. BrowserSessions and its option, view, and session types are now exported from agents/browser. Includes an end-to-end test on an Agent through a real codemode runtime facet, and the design record.
ben-reitz
force-pushed
the
feat/browser-execute-tool
branch
from
September 25, 2026 14:54
08e8a34 to
2e105ba
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds the public API:
createBrowserExecuteToolinagents/browser/ai, plus theBrowserSessionsexport fromagents/browser. Both are experimental and ship with a minor changeset.The host owns one
BrowserSessions, so tools rebuilt every turn reach the same browser. Tabs, cookies, and logins carry over until Browser Run'skeep_alivereclaims an idle browser.What the model gets back
{ executionId, result, logs, calls } // calls are persisted, not shown to the model + restarted: true, notice: "…navigate again…" // the browser was replaced before this run + newTabs: [{ targetId, url }] // tabs the page openedScreenshot summaries include the notice and
newTabsas well.Compared with
createBrowserToolscreateBrowserToolscreateBrowserExecuteToolBrowserSessions)cdpUrl, KitesurfcreateQuickActionToolscreateBrowserToolsis unchanged. It gets deprecated in a later PR.Details
browser-session_<name>), so execution history never mixes withcreateBrowserToolsor with other names.ctxis optional. It's resolved from the current Agent when not passed.createBrowserTools. The worker exportsCodemodeRuntime, which is re-exported fromagents/browser. The test worker gains a facet-onlyCodemodeRuntimebinding.Tests
End-to-end on a real Agent and codemode facet (
browser-capability.test.ts):Not in this PR: Think, TanStack AI, and Flue wrappers; CDP recipes; user docs.
Architecture diff
Outlined boxes are components this PR changes, with one green box per change. Green-filled boxes are new. Grey boxes are unchanged.
flowchart TB classDef ctx fill:none,stroke:#8c959f,color:#8c959f classDef changes fill:#dafbe1,stroke:#1a7f37,color:#1f2328 classDef removed fill:#ffebe9,stroke:#cf222e,color:#1f2328 classDef later fill:none,stroke:#8c959f,stroke-dasharray:4 3,color:#8c959f Agent["Agent (host Durable Object)"]:::ctx subgraph Tool["createBrowserExecuteTool · ai.ts (new)"] direction TB T1["+ browser_execute AI SDK tool"]:::changes T2["+ one codemode runtime per session name"]:::changes T3["+ adds restarted, notice, newTabs to results"]:::changes T1 ~~~ T2 ~~~ T3 end Runtime["codemode runtime + sandbox"]:::ctx Conn["BrowserSessionConnector · session-connector.ts"]:::ctx subgraph BS["BrowserSessions · capability.ts"] B1["+ exported from agents/browser, with its types"]:::changes end BR["Browser Run"]:::ctx Agent -->|"getTools()"| Tool Agent -->|lifecycle.use| BS Tool --> Runtime Runtime --> Conn Conn -->|"connect(name)"| BS BS --> BR style Tool fill:#dafbe1,stroke:#1a7f37,stroke-width:2px,color:#1f2328 style BS stroke:#1a7f37,stroke-width:2px