Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
Rename import from llm to models
Magnus Müller48b98de1df23
diff --git a/browser_use/__init__.py b/browser_use/__init__.pyindex c3a4e551d..e67fe8f4e 100644--- a/browser_use/__init__.py+++ b/browser_use/__init__.py@@ -51,7 +51,7 @@ if TYPE_CHECKING:from browser_use.browser import BrowserProfile, BrowserSessionfrom browser_use.browser import BrowserSession as Browserfrom browser_use.dom.service import DomService- from browser_use.llm import models as llm+ from browser_use.llm import modelsfrom browser_use.llm.anthropic.chat import ChatAnthropicfrom browser_use.llm.azure.chat import ChatAzureOpenAIfrom browser_use.llm.google.chat import ChatGoogle@@ -87,7 +87,7 @@ _LAZY_IMPORTS = {'ChatAzureOpenAI': ('browser_use.llm.azure.chat', 'ChatAzureOpenAI'),'ChatOllama': ('browser_use.llm.ollama.chat', 'ChatOllama'),# LLM models module- 'llm': ('browser_use.llm.models', None),+ 'models': ('browser_use.llm.models', None),}@@ -100,7 +100,7 @@ def __getattr__(name: str):module = import_module(module_path)if attr_name is None:- # For modules like 'llm', return the module itself+ # For modules like 'models', return the module itselfattr = moduleelse:attr = getattr(module, attr_name)@@ -134,5 +134,5 @@ __all__ = ['Tools','Controller',# LLM models module- 'llm',+ 'models',]diff --git a/examples/models/lazy_import.py b/examples/models/lazy_import.pyindex cbb7ae265..424371128 100644--- a/examples/models/lazy_import.py+++ b/examples/models/lazy_import.py@@ -1,6 +1,6 @@-from browser_use import Agent, llm+from browser_use import Agent, models# available providers for this import style: openai, azure, google-agent = Agent(task='Find founders of browser-use', llm=llm.openai_o3)+agent = Agent(task='Find founders of browser-use', llm=models.azure_gpt_4_1_mini)agent.run_sync()