Skip to content

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

no need to make a dict just to unwrap it immediately

Nick Sweeting072de0dcf8b6
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index a95daff46..a3eb93fa8 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -488,9 +488,10 @@ class Agent(Generic[Context]):
if not model_output.action or all(action.model_dump() == {} for action in model_output.action):
logger.warning('Model still returned empty after retry. Inserting safe noop action.')
- action_instance = self.ActionModel(
- **{'done': {'success': False, 'text': 'No action returned, safe exit.'}}
- )
+ action_instance = self.ActionModel(done={
+ 'success': False,
+ 'text': 'No next action returned by LLM!',
+ })
model_output.action = [action_instance]
# Check again for paused/stopped state after getting model output