Skip to content

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

Refine last step instructions and model testing configuration

Magnus Müllerd129a7f27a8c
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index 78aaf5e39..364b21475 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -340,11 +340,14 @@ class Agent(Generic[Context]):
# add plan before last state message
self._message_manager.add_plan(plan, position=-1)
- # Add last step warning if needed
if step_info and step_info.is_last_step():
- msg = 'Now comes your last step. You have to use the done action now! Provide your best result of the ultimate task given your findings inside the done action.'
+ # Add last step warning if needed
+ msg = 'Now comes your last step. You have to use the "done" action now immediately! No other actions are allowed.'
+ msg += '\nIf the task is not fully finished as requested by the user, set success in "done" to false!'
+ msg += '\nIf the task is fully finished, set success in "done" to true.'
+ msg += '\nMake sure you include everything you found out for the ultimate task in the done text parameter.'
logger.info('Last step finishing up')
- self._message_manager._add_message_with_tokens(HumanMessage(content=msg), position=-1)
+ self._message_manager._add_message_with_tokens(HumanMessage(content=msg))
self.AgentOutput = self.DoneAgentOutput
input_messages = self._message_manager.get_messages()
diff --git a/tests/test_models.py b/tests/test_models.py
index 916e44c25..0d5f30b7e 100644
--- a/tests/test_models.py
+++ b/tests/test_models.py
@@ -55,12 +55,12 @@ api_key_anthropic = SecretStr(os.getenv('ANTHROPIC_API_KEY') or '')
azure_endpoint=os.getenv('AZURE_OPENAI_ENDPOINT', ''),
api_key=SecretStr(os.getenv('AZURE_OPENAI_KEY', '')),
),
+ # ChatOpenAI(
+ # base_url='https://api.deepseek.com/v1',
+ # model='deepseek-reasoner',
+ # api_key=api_key_deepseek,
+ # ),
# run: ollama start
- ChatOpenAI(
- base_url='https://api.deepseek.com/v1',
- model='deepseek-reasoner',
- api_key=api_key_deepseek,
- ),
ChatOllama(
model='qwen2.5:latest',
num_ctx=128000,
@@ -91,7 +91,7 @@ api_key_anthropic = SecretStr(os.getenv('ANTHROPIC_API_KEY') or '')
'gpt-4o',
'gpt-4o-mini',
'azure-gpt-4o',
- 'deepseek-reasoner',
+ #'deepseek-reasoner',
'qwen2.5:latest',
'azure-gpt-4o-mini',
'claude-3-5-sonnet',