Skip to content

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

change gemini 2.5 flash to gemini latest

Magnus Müller781f948bb8fa
diff --git a/README.md b/README.md
index ac21ef1da..70a90f192 100644
--- a/README.md
+++ b/README.md
@@ -60,7 +60,7 @@ load_dotenv()
agent = Agent(
task="Find the number of stars of the browser-use repo",
- llm=ChatGoogle(model="gemini-2.5-flash"),
+ llm=ChatGoogle(model="gemini-flash-latest"),
# browser=Browser(use_cloud=True), # Uses Browser-Use cloud for the browser
)
agent.run_sync()
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index 93f95524c..054158a89 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -707,6 +707,7 @@ class Agent(Generic[Context, AgentStructuredOutput]):
# Page-specific actions will be included directly in the browser_state message
self.logger.debug(f'💬 Step {self.state.n_steps}: Creating state messages for context...')
+
self._message_manager.create_state_messages(
browser_state_summary=browser_state_summary,
model_output=self.state.last_model_output,
diff --git a/browser_use/llm/google/chat.py b/browser_use/llm/google/chat.py
index 593bc5920..ad511bb26 100644
--- a/browser_use/llm/google/chat.py
+++ b/browser_use/llm/google/chat.py
@@ -28,6 +28,8 @@ VerifiedGeminiModels = Literal[
'Gemini-2.0-exp',
'gemini-2.5-flash',
'gemini-2.5-flash-lite',
+ 'gemini-flash-latest',
+ 'gemini-flash-lite-latest',
'gemini-2.5-pro',
'gemma-3-27b-it',
'gemma-3-4b',
diff --git a/docs/customize/agent/supported-models.mdx b/docs/customize/agent/supported-models.mdx
index 5b5883189..35b67a7fa 100644
--- a/docs/customize/agent/supported-models.mdx
+++ b/docs/customize/agent/supported-models.mdx
@@ -9,7 +9,7 @@ icon: "robot"
- Best accuracy: `O3`
- Fastest: `llama4` on groq
-- Balanced: fast + cheap + clever: `gemini-2.5-flash` or `gpt-4.1-mini`
+- Balanced: fast + cheap + clever: `gemini-flash-latest` or `gpt-4.1-mini`
### OpenAI [example](https://github.com/browser-use/browser-use/blob/main/examples/models/gpt-4.1.py)
@@ -104,7 +104,7 @@ from dotenv import load_dotenv
load_dotenv()
# Initialize the model
-llm = ChatGoogle(model='gemini-2.5-flash')
+llm = ChatGoogle(model='gemini-flash-latest')
# Create agent with the model
agent = Agent(
diff --git a/docs/examples/templates/fast-agent.mdx b/docs/examples/templates/fast-agent.mdx
index ef1946915..1bdd72c98 100644
--- a/docs/examples/templates/fast-agent.mdx
+++ b/docs/examples/templates/fast-agent.mdx
@@ -31,7 +31,7 @@ async def main():
)
# from browser_use import ChatGoogle
- # llm = ChatGoogle(model='gemini-2.5-flash')
+ # llm = ChatGoogle(model='gemini-flash-lite-latest')
# 2. Create speed-optimized browser profile
browser_profile = BrowserProfile(
@@ -74,7 +74,7 @@ llm = ChatGroq(model='meta-llama/llama-4-maverick-17b-128e-instruct')
# Google Gemini Flash - Optimized for speed
from browser_use import ChatGoogle
-llm = ChatGoogle(model='gemini-2.5-flash')
+llm = ChatGoogle(model='gemini-flash-lite-latest')
```
### 2. Browser Optimizations
diff --git a/docs/quickstart.mdx b/docs/quickstart.mdx
index 189bc4998..3e836b03d 100644
--- a/docs/quickstart.mdx
+++ b/docs/quickstart.mdx
@@ -96,7 +96,7 @@ import asyncio
load_dotenv()
async def main():
- llm = ChatGoogle(model="gemini-2.5-flash")
+ llm = ChatGoogle(model="gemini-flash-latest")
task = "Find the number 1 post on Show HN"
agent = Agent(task=task, llm=llm)
await agent.run()
diff --git a/examples/getting_started/05_fast_agent.py b/examples/getting_started/05_fast_agent.py
index a6aa2f1e9..09ac4b0cd 100644
--- a/examples/getting_started/05_fast_agent.py
+++ b/examples/getting_started/05_fast_agent.py
@@ -31,7 +31,7 @@ async def main():
)
# from browser_use import ChatGoogle
- # llm = ChatGoogle(model='gemini-2.5-flash')
+ # llm = ChatGoogle(model='gemini-flash-latest')
# 2. Create speed-optimized browser profile
browser_profile = BrowserProfile(
diff --git a/examples/models/gemini.py b/examples/models/gemini.py
index fa1fe223c..f37d337b0 100644
--- a/examples/models/gemini.py
+++ b/examples/models/gemini.py
@@ -14,7 +14,7 @@ api_key = os.getenv('GOOGLE_API_KEY')
if not api_key:
raise ValueError('GOOGLE_API_KEY is not set')
-llm = ChatGoogle(model='gemini-2.5-flash', api_key=api_key, temperature=0.0)
+llm = ChatGoogle(model='gemini-flash-latest', api_key=api_key, temperature=0.0)
async def run_search():
diff --git a/examples/simple.py b/examples/simple.py
index 231fc2dbe..4b4403047 100644
--- a/examples/simple.py
+++ b/examples/simple.py
@@ -6,7 +6,7 @@ load_dotenv()
agent = Agent(
task='Find the number of stars of the browser-use repo',
- llm=ChatGoogle(model='gemini-2.5-flash'),
+ llm=ChatGoogle(model='gemini-flash-latest'),
# browser=Browser(use_cloud=True), # Uses Browser-Use cloud for the browser
)
agent.run_sync()