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 fix/1430/example-tool-call-click-action

Nick Sweeting590733da87bf
diff --cc browser_use/agent/message_manager/service.py
index b897fc6b4,fcd5125ad..b6041efb4
--- a/browser_use/agent/message_manager/service.py
+++ b/browser_use/agent/message_manager/service.py
@@@ -81,25 -82,26 +82,27 @@@ class MessageManager
which directed me to the 'Apple' company homepage. This is a good start toward finding
the best place to buy a new iPhone as the Apple website often list iPhones for sale.
""".strip(),
- 'memory': """
+ 'memory': """
I searched for 'iPhone retailers' on Google. From the Google Search results page,
- I used the 'click_element' tool to click on a element labelled 'Best Buy' but calling
- the tool did not direct me to a new page. I then used the 'click_element' tool to click
- on a element labelled 'Apple' which redirected me to the 'Apple' company homepage.
+ I used the 'click_element_by_index' tool to click on element at index [45] labeled 'Best Buy' but calling
+ the tool did not direct me to a new page. I then used the 'click_element_by_index' tool to click
+ on element at index [82] labeled 'Apple' which redirected me to the 'Apple' company homepage.
Currently at step 3/15.
""".strip(),
- 'next_goal': """
+ 'next_goal': """
Looking at reported structure of the current page, I can see the item '[127]<h3 iPhone/>'
in the content. I think this button will lead to more information and potentially prices
- for iPhones. I'll click on the link to 'iPhone' at index [127] using the 'click_element'
+ for iPhones. I'll click on the link at index [127] using the 'click_element_by_index'
tool and hope to see prices on the next page.
""".strip(),
+ },
- 'action': [{'click_element': {'index': 127}}],
++ 'action': [{'click_element_by_index': {'index': 127}}],
},
+ 'action': [{'click_element_by_index': {'index': 127}}],
+ 'id': str(self.state.tool_id),
+ 'type': 'tool_call',
},
- 'id': str(self.state.tool_id),
- 'type': 'tool_call',
- },]
+ ],
)
self._add_message_with_tokens(example_tool_call, message_type='init')
self.add_tool_message(content='Browser started', message_type='init')