Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

set default_llm

Magnus Müllerc1a28ba50365
diff --git a/browser_use/__init__.py b/browser_use/__init__.py
index 848e4f8e9..ed566be9a 100644
--- a/browser_use/__init__.py
+++ b/browser_use/__init__.py
@@ -1,8 +1,12 @@
import os
from typing import TYPE_CHECKING
+# Default model - users can change this
+from browser_use.llm.openai.chat import ChatOpenAI
from browser_use.logging_config import setup_logging
+default_llm = ChatOpenAI(model='gpt-4.1-mini')
+
# Only set up logging if not in MCP mode or if explicitly requested
if os.environ.get('BROWSER_USE_SETUP_LOGGING', 'true').lower() != 'false':
logger = setup_logging()
diff --git a/examples/simple.py b/examples/simple.py
index 8b50a61d9..e56170cbb 100644
--- a/examples/simple.py
+++ b/examples/simple.py
@@ -8,21 +8,11 @@ from dotenv import load_dotenv
load_dotenv()
-from browser_use import Agent, ChatOpenAI
+from browser_use import Agent, default_llm
async def main():
- # Choose your model
- llm = ChatOpenAI(model='gpt-4.1-mini')
-
- # Define your task
- task = 'Go and find the founders of browser-use'
-
- # Create the agent
- agent = Agent(task=task, llm=llm)
-
- # Start
- await agent.run(max_steps=2)
+ await Agent('Find the founders of browser-use', default_llm).run()
if __name__ == '__main__':