Skip to content

Commit 4b22bab

Browse files
authored
Merge pull request #160 from browser-use/v4-onboarding
fix(browser): provision cloud browsers through V4
2 parents b48dbef + 9651c9f commit 4b22bab

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

packages/bcode-browser/skills/browser-execute/SKILL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ Choose when the computer has no browser or to work in the background.
6666
6767
```js
6868
// Provision and connect to a cloud browser
69-
const r = await fetch("https://api.browser-use.com/api/v3/browsers", {
69+
const r = await fetch("https://api.browser-use.com/api/v4/browsers", {
7070
method: "POST",
7171
headers: { "X-Browser-Use-API-Key": process.env.BROWSER_USE_API_KEY, "Content-Type": "application/json" },
7272
body: "{}",
7373
})
74-
// Additional options: fetch https://docs.browser-use.com/cloud/api-v3/browsers/create-browser-session
74+
// Additional options: fetch https://docs.browser-use.com/cloud/openapi/v4.json
7575
const { id, cdpUrl, liveUrl } = await r.json()
7676
const ver = await fetch(`${cdpUrl}/json/version`).then(r => r.json())
7777
await session.connect({ wsUrl: ver.webSocketDebuggerUrl })
@@ -80,7 +80,7 @@ console.log("liveUrl for the user to watch:", liveUrl)
8080
8181
```js
8282
// Browser Use cloud will eventually close idle browsers. An explicit stop frees the slot:
83-
await fetch(`https://api.browser-use.com/api/v3/browsers/${id}`, {
83+
await fetch(`https://api.browser-use.com/api/v4/browsers/${id}`, {
8484
method: "PATCH",
8585
headers: { "X-Browser-Use-API-Key": process.env.BROWSER_USE_API_KEY, "Content-Type": "application/json" },
8686
body: JSON.stringify({ action: "stop" }),

packages/bcode-browser/test/skills.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ test("resolveSkillsDir materializes skills with {{SKILLS_DIR}} substituted", asy
1717
const browser = (await fs.readFile(path.join(dir, "browser-execute", "SKILL.md"), "utf8")).replaceAll("\\", "/")
1818
expect(browser).not.toContain("{{SKILLS_DIR}}")
1919
expect(browser).toContain(`${dir.replaceAll("\\", "/")}/`)
20+
expect(browser).toContain('fetch("https://api.browser-use.com/api/v4/browsers"')
21+
expect(browser).toContain("fetch(`https://api.browser-use.com/api/v4/browsers/${id}`")
22+
expect(browser).toContain("https://docs.browser-use.com/cloud/openapi/v4.json")
23+
expect(browser).not.toContain("https://api.browser-use.com/api/v3")
2024
} finally {
2125
await fs.rm(dataDir, { recursive: true, force: true })
2226
}

0 commit comments

Comments
 (0)