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 eventbus

Nick Sweetingc9f7aec8ceca
diff --cc browser_use/agent/service.py
index 6481eed71,411ade5a0..2c598ae97
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@@ -533,13 -500,13 +533,13 @@@ class Agent(Generic[Context])
return True
except (json.JSONDecodeError, AttributeError, TypeError) as e:
- logger.debug(f'🛠️ Tool calling method {method} failed: Failed to parse JSON content: {e}')
+ self.logger.debug(f'🛠️ Tool calling method {method} failed: Failed to parse JSON content: {e}')
return False
- if method == 'raw':
+ if method == 'raw' or method == 'json_mode':
# For raw mode, test JSON response format
test_prompt = f"""{CAPITAL_QUESTION}
- Respond with a JSON object like: {{"answer": "city_name_in_lowercase"}}"""
+ Respond with a json object like: {{"answer": "city_name_in_lowercase"}}"""
response = self.llm.invoke([test_prompt])
# Basic validation of response