Skip to content

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

Merge branch 'main' into cursor/make-tool-call-example-parameter-optional-3d84

Mert Unsalf5ee0d609725
diff --cc browser_use/agent/message_manager/service.py
index f042bac3e,b48dbdb62..386c37a7c
--- a/browser_use/agent/message_manager/service.py
+++ b/browser_use/agent/message_manager/service.py
@@@ -165,22 -163,20 +165,22 @@@ class MessageManager
"""Initialize the message history with system message, context, task, and other initial messages"""
self._add_message_with_type(self.system_prompt)
- placeholder_message = UserMessage(
- content='<example_1>\nHere is an example output of thinking and tool call. You can use it as a reference but do not copy it exactly.',
- cache=True,
- )
- # placeholder_message = HumanMessage(content='Example output:')
- self._add_message_with_type(placeholder_message)
+ # Only add tool call examples if enabled
+ if self.include_tool_call_examples:
+ placeholder_message = UserMessage(
+ content='<example_1>\nHere is an example output of thinking and tool call. You can use it as a reference but do not copy it exactly.',
+ cache=True,
+ )
+ # placeholder_message = HumanMessage(content='Example output:')
+ self._add_message_with_type(placeholder_message)
- example_content = dict()
+ example_content = dict()
- # Add thinking field only if use_thinking is True
- if self.use_thinking:
- example_content[
- 'thinking'
- ] = """I have successfully navigated to https://github.com/explore and can see the page has loaded with a list of featured repositories. The page contains interactive elements and I can identify specific repositories like bytedance/UI-TARS-desktop (index [4]) and ray-project/kuberay (index [5]). The user's request is to explore GitHub repositories and collect information about them such as descriptions, stars, or other metadata. So far, I haven't collected any information.
+ # Add thinking field only if use_thinking is True
+ if self.use_thinking:
+ example_content[
+ 'thinking'
+ ] = """I have successfully navigated to https://github.com/explore and can see the page has loaded with a list of featured repositories. The page contains interactive elements and I can identify specific repositories like bytedance/UI-TARS-desktop (index [4]) and ray-project/kuberay (index [5]). The user's request is to explore GitHub repositories and collect information about them such as descriptions, stars, or other metadata. So far, I haven't collected any information.
My navigation to the GitHub explore page was successful. The page loaded correctly and I can see the expected content.
I need to capture the key repositories I've identified so far into my memory and into a file.
Since this appears to be a multi-step task involving visiting multiple repositories and collecting their information, I need to create a structured plan in todo.md.