Skip to content

Commit d01253d

Browse files
authored
fix(browser-use): use Cloud V4 with bounded session cleanup (#1879)
1 parent b0f3962 commit d01253d

6 files changed

Lines changed: 858 additions & 71 deletions

File tree

‎README.md‎

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,7 +1920,7 @@ Get your API key from the [Browserbase Dashboard](https://browserbase.com/overvi
19201920
19211921
### Browser Use
19221922
1923-
[Browser Use](https://browser-use.com) provides cloud browser infrastructure for AI agents. Use it when running agent-browser in environments where a local browser isn't available (serverless, CI/CD, etc.).
1923+
[Browser Use](https://browser-use.com) is an open-source browser automation project for AI agents with [over 100,000 GitHub stars](https://github.com/browser-use/browser-use), plus a managed Cloud browser service. Browser Use Cloud is useful when running agent-browser in environments where a local browser isn't available, such as serverless and CI environments.
19241924
19251925
To enable Browser Use, use the `-p` flag:
19261926
@@ -1937,9 +1937,32 @@ export BROWSER_USE_API_KEY="your-api-key"
19371937
agent-browser open https://example.com
19381938
```
19391939
1940-
When enabled, agent-browser connects to a Browser Use cloud session instead of launching a local browser. All commands work identically.
1940+
Optional Browser Use Cloud settings:
19411941
1942-
Get your API key from the [Browser Use Cloud Dashboard](https://cloud.browser-use.com/settings?tab=api-keys). Free credits are available to get started, with pay-as-you-go pricing after.
1942+
| Variable | Description |
1943+
| ------------------------------ | ---------------------------------------------------------- |
1944+
| `BROWSER_USE_PROFILE_ID` | Profile UUID for persistent cookies and logins |
1945+
| `BROWSER_USE_PROXY_COUNTRY` | Managed proxy country, or `none`/`direct` to disable proxy |
1946+
| `BROWSER_USE_ENABLE_RECORDING` | Record the Cloud browser session |
1947+
1948+
```bash
1949+
export BROWSER_USE_PROFILE_ID="your-profile-uuid"
1950+
export BROWSER_USE_PROXY_COUNTRY="de"
1951+
export BROWSER_USE_ENABLE_RECORDING="true"
1952+
agent-browser -p browseruse open https://example.com
1953+
```
1954+
1955+
When enabled, agent-browser creates a Browser Use Cloud V4 session and connects to its CDP endpoint. Browser Use setup is limited to 18 seconds, with up to 4 more seconds for cleanup if setup times out. Within setup, creation waits up to 10 seconds and CDP attachment up to 8 seconds; each stop request waits up to 4 seconds. Navigation and other page commands keep their existing timeouts. If creation fails before a browser id is returned, the outcome is unknown; inspect the Browser Use Cloud dashboard before retrying, since a browser may still have been created.
1956+
1957+
The Cloud browser stays active between commands. Run `agent-browser close` when the task finishes. The daemon also attempts cleanup on exit, including its default one-hour idle timeout; a failed stop can leave the Cloud browser running.
1958+
1959+
`close` succeeds only after Browser Use acknowledges the browser as stopped. On a failed stop, `close` returns an error and keeps the session id, so running `agent-browser close` again retries the same browser, and a new launch is blocked until the pending browser is released.
1960+
1961+
If the daemon exits before a stop succeeds, inspect the Browser Use Cloud dashboard and stop the browser there.
1962+
1963+
If a stop keeps returning 404, verify the browser status in Browser Use Cloud. After confirming it has stopped, use a new `--session` name to continue; agent-browser does not treat 404 as proof of a successful stop.
1964+
1965+
Get your API key from the [Browser Use Cloud Dashboard](https://cloud.browser-use.com/settings?tab=api-keys).
19431966
19441967
### Kernel
19451968

0 commit comments

Comments
 (0)