Skip to content

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

Models examples

Magnus Müller1d84150fe548
diff --git a/examples/search/search_url.py b/examples/api/search/search_url.py
similarity index 100%
rename from examples/search/search_url.py
rename to examples/api/search/search_url.py
diff --git a/examples/search/simple_search.py b/examples/api/search/simple_search.py
similarity index 100%
rename from examples/search/simple_search.py
rename to examples/api/search/simple_search.py
diff --git a/examples/models/README.md b/examples/models/README.md
deleted file mode 100644
index 5308e8a83..000000000
--- a/examples/models/README.md
+++ /dev/null
@@ -1,2 +0,0 @@
-# Gemini
-Detailed video on how to integrate browser-use with Gemini: https://www.youtube.com/watch?v=JluZiWBV_Tc
diff --git a/examples/models/azure_openai.py b/examples/models/azure_openai.py
index f5f03d8b9..653d70518 100644
--- a/examples/models/azure_openai.py
+++ b/examples/models/azure_openai.py
@@ -18,9 +18,13 @@ load_dotenv()
from browser_use import Agent
from browser_use.llm import ChatAzureOpenAI
-# Initialize the Azure OpenAI client
+# Make sure your deployment exists, double check the region and model name
+api_key = os.getenv('AZURE_OPENAI_KEY')
+azure_endpoint = os.getenv('AZURE_OPENAI_ENDPOINT')
llm = ChatAzureOpenAI(
- model='o4-mini',
+ model='gpt-4.1-mini',
+ api_key=api_key,
+ azure_endpoint=azure_endpoint,
)
TASK = """
@@ -35,7 +39,6 @@ agent = Agent(
async def main():
await agent.run(max_steps=10)
- input('Press Enter to continue...')
asyncio.run(main())
diff --git a/examples/models/gemini.py b/examples/models/gemini.py
index 9a48939b1..930cb3100 100644
--- a/examples/models/gemini.py
+++ b/examples/models/gemini.py
@@ -12,9 +12,7 @@ load_dotenv()
Laminar.initialize()
-from browser_use import Agent
-from browser_use.browser import BrowserProfile, BrowserSession
-from browser_use.llm import ChatGoogle
+from browser_use import Agent, ChatGoogle
api_key = os.getenv('GOOGLE_API_KEY')
if not api_key:
@@ -22,20 +20,11 @@ if not api_key:
llm = ChatGoogle(model='gemini-2.5-flash', api_key=api_key)
-browser_session = BrowserSession(
- browser_profile=BrowserProfile(
- viewport_expansion=0,
- user_data_dir='~/.config/browseruse/profiles/default',
- )
-)
-
async def run_search():
agent = Agent(
task='Go to google.com/travel/flights and find the cheapest flight from New York to Paris on 2025-07-15',
llm=llm,
- max_actions_per_step=4,
- browser_session=browser_session,
)
await agent.run(max_steps=25)
diff --git a/examples/models/gpt-4.1.py b/examples/models/gpt-4.1.py
index 8320d11ab..0fb3c3b61 100644
--- a/examples/models/gpt-4.1.py
+++ b/examples/models/gpt-4.1.py
@@ -19,7 +19,7 @@ Laminar.initialize()
# All the models are type safe from OpenAI in case you need a list of supported models
llm = ChatOpenAI(model='gpt-4.1-mini')
agent = Agent(
- task='Go to example.com, click on the first link, and give me the title of the page',
+ task='Go to amazon.com, click on the first link, and give me the title of the page',
llm=llm,
)
diff --git a/examples/models/gpt-5-mini.py b/examples/models/gpt-5-mini.py
index ce31c872e..079f03442 100644
--- a/examples/models/gpt-5-mini.py
+++ b/examples/models/gpt-5-mini.py
@@ -19,8 +19,8 @@ Laminar.initialize()
# All the models are type safe from OpenAI in case you need a list of supported models
llm = ChatOpenAI(model='gpt-5-mini')
agent = Agent(
- task='Find out which one is cooler: the monkey park or a dolphin tour in Tenerife?',
llm=llm,
+ task='Find out which one is cooler: the monkey park or a dolphin tour in Tenerife?',
)