Repository navigation
[CB-0] [sdk-superfan] Add a working browser-use example - #215
Closed
spicysouvlaki wants to merge 1 commit into
Closed
spicysouvlaki wants to merge 1 commit into
spicysouvlaki wants to merge 1 commit into
Conversation
Issue #144: the docs' browser-use snippet failed with Playwright's `KeyError: 'error'` in _connection.py dispatch. The reporter's log shows "Connecting to remote browser via WSS", which is browser-use 0.1.x's BrowserConfig(wss_url=...) path (browser_use/browser/browser.py:124 in 0.1.40). It calls playwright.chromium.connect(), which speaks Playwright's own wire protocol. A Browserbase connect_url speaks CDP, so the first reply is a CDP error object with no nested "error" field and Playwright's dispatch() raises KeyError. Reproduced on a live dev session with playwright 1.51.0. cdp_url (connect_over_cdp) was the right option. The docs have since switched to Browser(browser_profile=BrowserProfile( cdp_url=...)), but browser-use 1.0 removed BrowserProfile, so that snippet now fails with ImportError. 1.0 takes Browser(cdp_url=...). browser-use 1.0 needs Python >= 3.11 and this repo's dev env and lint run on 3.9, so the example is a PEP 723 script with its own deps, and file-level mypy/pyright directives keep ./scripts/lint green without installing it. Browser.stop() never ends a cdp_url browser, so the example releases the session with REQUEST_RELEASE instead of leaving it billing until timeout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
spicysouvlaki
marked this pull request as ready for review
November 16, 2026 20:47
Collaborator
Author
|
Closing: we're not shipping a browser-use example in the SDK. |
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.
What happened. In #144, the BrowserUse docs example failed with:
Why. The log line
Connecting to remote browser via WSScomes from browser-use 0.1.xBrowserConfig(wss_url=...)(browser_use/browser/browser.py:124in 0.1.40). That path callsplaywright.chromium.connect(), which speaks Playwright's wire protocol.connect_urlspeaks CDP, so Playwright misparses the first CDP error. The docs moved toBrowserProfile(cdp_url=...), but browser-use 1.0 removedBrowserProfile, so today's docs snippet fails with anImportError.Fix. Adds
examples/browser_use_basic.py. It usesBrowser(cdp_url=session.connect_url)(browser-use ≥1.0.6, SDK ≥1.26.0) and releases the session afterwards, becauseBrowser.stop()never ends acdp_urlbrowser. The example is a PEP 723 script because browser-use needs Python ≥3.11 and this repo's lint runs on 3.9.Tests.
COMPLETED.connect()): reproducedKeyError: 'error'at_connection.py:393../scripts/lintpasses.Risk and rollout. Example only.
examples/is never regenerated, and no generated files changed. The docs page still needs the sameBrowser(cdp_url=...)change.Refs #144
🤖 Generated with Claude Code