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-sdkVerified import paths — ran on the pinned version, not inferred.
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.
Migrate client instantiation to `from browser_use_sdk.v3 import AsyncBrowserUse` and adapt task execution to `await client.run('your task')`.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.
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.
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.
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.
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`.
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.
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.
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.
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()`.