Skip to content

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

Add task and example information

magmueller79d96a9e1c81
diff --git a/browser_use/agent/message_manager/service.py b/browser_use/agent/message_manager/service.py
index 211629a58..b2cc2e0bc 100644
--- a/browser_use/agent/message_manager/service.py
+++ b/browser_use/agent/message_manager/service.py
@@ -61,7 +61,7 @@ class MessageManager:
self.system_prompt = system_message
if self.message_context:
- context_message = HumanMessage(content=self.message_context)
+ context_message = HumanMessage(content='Context for the task' + self.message_context)
self._add_message_with_tokens(context_message)
task_message = self.task_instructions(task)
@@ -73,14 +73,17 @@ class MessageManager:
info_message = HumanMessage(content=info)
self._add_message_with_tokens(info_message)
+ placeholder_message = HumanMessage(content='Example output:')
+ self._add_message_with_tokens(placeholder_message)
+
self.tool_id = 1
tool_calls = [
{
'name': 'AgentOutput',
'args': {
'current_state': {
- 'evaluation_previous_goal': 'Unknown - No previous actions to evaluate.',
- 'memory': '',
+ 'evaluation_previous_goal': 'Success - No previous actions to evaluate.',
+ 'memory': 'Starting with the new task 0/10 done',
'next_goal': 'Start browser',
},
'action': [],
@@ -103,6 +106,9 @@ class MessageManager:
self.tool_id += 1
+ placeholder_message = HumanMessage(content='Task history starts here:')
+ self._add_message_with_tokens(placeholder_message)
+
@staticmethod
def task_instructions(task: str) -> HumanMessage:
content = f'Your ultimate task is: """{task}""". If you achieved your ultimate task, stop everything and use the done action in the next step to complete the task. If not, continue as usual.'