Registry / llm-agents / browser-use-sdk

browser-use-sdk

JSON →
library3.11.1pypypi✓ verified 24d ago

The `browser-use-sdk` is the official Python SDK for the Browser Use Cloud API, enabling AI agents to automate complex web tasks. It provides state-of-the-art browser automation with features like stealth browsers, CAPTCHA solving, and residential proxies, allowing for data extraction, form filling, multi-step workflows, and research. The current version is 3.4.3, and it maintains an active release cadence with frequent updates.

pip install browser-use-sdk
INSTALL
IMPORT
SIG · BROWSER-USE-SDK
B
browser-use-sdk
llm-agentspythonv3.11.1
Install
4.1s avg
Import
1136ms
Disk
31MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v3.11.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.944s · 32.6MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.1s · import 0.874s · 32MB
31MB installed
● package 31MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AsyncBrowserUse
from browser_use_sdk.v3 import AsyncBrowserUse
from browser_use_sdk import BrowserUseClient
The `BrowserUseClient` import pattern was used in older SDK versions (e.g., pre-3.0). Version 3 and above use `AsyncBrowserUse` from the `v3` submodule.

This quickstart demonstrates how to initialize the `AsyncBrowserUse` client and execute a natural language task. It expects the `BROWSER_USE_API_KEY` to be set as an environment variable. The `client.run()` method initiates an AI agent to perform the specified web automation task and returns the result.

import asyncio import os from browser_use_sdk.v3 import AsyncBrowserUse async def main(): api_key = os.environ.get('BROWSER_USE_API_KEY', '') if not api_key: print("Error: BROWSER_USE_API_KEY environment variable not set.") print("Please get your API key at cloud.browser-use.com/settings and set it.") return # The SDK automatically picks up BROWSER_USE_API_KEY from environment variables. # Alternatively, pass it explicitly: client = AsyncBrowserUse(api_key=api_key) client = AsyncBrowserUse() try: # Run an AI agent task with natural language instructions result = await client.run("Find the top 3 trending repositories on GitHub today and list their names and URLs") print("Agent Output:", result.output) except Exception as e: print(f"An error occurred during agent execution: {e}") if __name__ == "__main__": asyncio.run(main())
Debug
Known issues
breakingSDK 3.0 introduced significant breaking changes, particularly affecting client initialization and the main task execution method. Users upgrading from pre-3.0 versions must update their code to use the new `AsyncBrowserUse` client and `client.run()` API, which offers a cleaner interface.
fix
Migrate client instantiation to `from browser_use_sdk.v3 import AsyncBrowserUse` and adapt task execution to `await client.run('your task')`.
affects: <3.0.0
gotchaThe SDK requires an API key for interaction with the Browser Use Cloud API. This key (`BROWSER_USE_API_KEY`) is typically read from environment variables. Failing to set a valid key will prevent tasks from running, often leading to errors or the agent getting stuck without clear explanations.
fix
Ensure `BROWSER_USE_API_KEY` is set in your environment (e.g., `export BROWSER_USE_API_KEY=your_key`) or passed explicitly to the client constructor (`AsyncBrowserUse(api_key='your_key')`). Obtain your key from cloud.browser-use.com/settings.
affects: All
gotchaThe primary SDK client, `AsyncBrowserUse`, is inherently asynchronous. All API calls (e.g., `client.run()`) must be `await`ed within an `async` function. This `async` function must then be executed using an event loop, typically `asyncio.run()`. Attempting synchronous calls will result in runtime errors.
fix
Wrap your SDK calls in `async def` functions and use `asyncio.run(your_async_function())` to execute them. Ensure Python's `asyncio` patterns are followed.
affects: All
gotchaA common debugging scenario is the agent getting 'stuck on Step 1' or entering an infinite loop. This often points to issues like an invalid, expired, or out-of-credit API key, the selected LLM model lacking necessary tool-calling functionality, underlying network problems, or enabling vision (`use_vision=True`) with a model that doesn't support it.
fix
Verify API key validity and credit balance. Check LLM model compatibility for tool-calling and vision features. Diagnose network connectivity. Review debug logs for more specific error messages from the underlying LLM calls.
affects: All
gotchaWhile powerful, the SDK might exhibit unreliability when performing intricate web scraping or automation on highly dynamic, JavaScript-heavy websites, or those employing infinite scrolling. This can lead to partial data extraction, inconsistent behavior, or agents failing to navigate correctly on such pages.
fix
For highly dynamic sites, consider adding explicit wait conditions, increasing timeouts, or carefully crafting prompts to guide the agent through page interactions. Monitor agent behavior closely on complex targets.
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'browser_use_sdk'
This error occurs when the `browser-use-sdk` package is not installed, or there's a confusion between the `browser-use-sdk` and `browser-use` package names.
fix
Ensure the correct package is installed using `pip install browser-use-sdk` or `pip install browser-use` depending on which library you intend to use. If using `browser-use`, the import should be `from browser_use import Agent`.
Connection error.
This generic 'Connection error' often indicates underlying issues such as a failed SSL handshake with API endpoints (especially on macOS with Python's built-in LibreSSH), general network connectivity problems, or misconfigured proxy settings.
fix
For SSL handshake issues on macOS, install Python using Homebrew or Pyenv to ensure OpenSSL is used. Otherwise, check your internet connection, proxy settings, and ensure there are no firewalls blocking outgoing requests to the Browser Use Cloud API.
ERROR [agent] ❌ Result failed 1/5 times: Error code: 401 - {'error': {'message': 'Authentication Fails (no such user)'
This 401 Authentication Error explicitly indicates that the provided API key is invalid, expired, or lacks the necessary permissions, preventing the agent from authenticating with the Browser Use Cloud API.
fix
Verify that your `BROWSER_USE_API_KEY` (or `OPENAI_API_KEY` if using an OpenAI model) is correctly set and is valid and active in your environment or code. Generate a new API key if necessary and ensure it's loaded properly.
INFO [agent] 📍 Step 1 (repeating indefinitely)
The agent gets stuck in 'Step 1' typically when its underlying Large Language Model (LLM) calls fail, often due to an invalid LLM API key, the chosen model not supporting required functionalities (like tool calling or vision), or persistent network issues preventing communication with the LLM API.
fix
Check your LLM API key for correctness and sufficient credits. Ensure the selected LLM model (`llm_model` parameter) is appropriate for the task and supports necessary features. Enable debug logging (`BROWSER_USE_LOGGING_LEVEL=debug`) for more detailed diagnostics of LLM interactions.
AttributeError: 'Agent' object has no attribute 'browser'
This error arises when trying to access a `browser` attribute directly on an `Agent` object. The SDK's design separates the browser lifecycle (managed by `Browser` and `BrowserContext`) from the `Agent`'s task execution.
fix
Instead of `agent.browser`, you should manage the `Browser` and `BrowserContext` separately and pass the `browser_context` to the `Agent` upon initialization. Ensure you close the `browser_context` and `browser` directly after use. For example: `agent = Agent(task="...", browser_context=my_browser_context, llm=llm)` and then `await my_browser_context.close()` and `await my_browser.close()`.
Upgrade
Version history
3.11.1latest on PyPI · released Aug 22, 2026
Audit
Dependencies
PythonrequiredRequired for running the SDK.
Agent activity
20 hits · last 30 days
node
18
OpenAI (training)
1
Resources
browser-use-sdk — pip install browser-use-sdk · libregistry