Skip to content

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

no screenshot in the beginning blank page

mertunsall32569460b426
diff --git a/browser_use/agent/prompts.py b/browser_use/agent/prompts.py
index b5fae75c4..45a847e28 100644
--- a/browser_use/agent/prompts.py
+++ b/browser_use/agent/prompts.py
@@ -174,6 +174,15 @@ Interactive elements from top layer of the current page inside the viewport{trun
return agent_state
def get_user_message(self, use_vision: bool = True) -> UserMessage:
+ # Don't pass screenshot to model if page is about:blank, step is 0, and there's only one tab
+ if (
+ self.browser_state.url == 'about:blank'
+ and self.step_info is not None
+ and self.step_info.step_number == 0
+ and len(self.browser_state.tabs) == 1
+ ):
+ use_vision = False
+
state_description = (
'<agent_history>\n'
+ (self.agent_history_description.strip('\n') if self.agent_history_description else '')
diff --git a/examples/features/custom_system_prompt.py b/examples/features/custom_system_prompt.py
index a19af6beb..c0770bb72 100644
--- a/examples/features/custom_system_prompt.py
+++ b/examples/features/custom_system_prompt.py
@@ -9,6 +9,14 @@ from dotenv import load_dotenv
load_dotenv()
+try:
+ from lmnr import Laminar
+
+ Laminar.initialize(project_api_key=os.getenv('LMNR_PROJECT_API_KEY'))
+except Exception as e:
+ print(f'Error initializing Laminar: {e}')
+
+
from browser_use import Agent
from browser_use.llm import ChatOpenAI
@@ -20,7 +28,7 @@ extend_system_message = (
async def main():
- task = "do google search to find images of Elon Musk's wife"
+ task = 'do google search to find images of Elon Musk'
model = ChatOpenAI(model='gpt-4o')
agent = Agent(task=task, llm=model, extend_system_message=extend_system_message)