Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
Output structure msg
Magnus Müller66c2d7dd973c
diff --git a/browser_use/agent/views.py b/browser_use/agent/views.pyindex 7a92906d4..662a4d000 100644--- a/browser_use/agent/views.py+++ b/browser_use/agent/views.py@@ -649,6 +649,22 @@ class AgentError:return f'{AgentError.VALIDATION_ERROR}\nDetails: {str(error)}'if isinstance(error, RateLimitError):return AgentError.RATE_LIMIT_ERROR++ # Handle LLM response validation errors from llm_use+ error_str = str(error)+ if 'LLM response missing required fields' in error_str or 'Expected format: AgentOutput' in error_str:+ # Extract the main error message without the huge stacktrace+ lines = error_str.split('\n')+ main_error = lines[0] if lines else error_str++ # Provide a clearer error message+ helpful_msg = f'{main_error}\n\nThe previous response had an invalid output structure. Please stick to the required output format. \n\n'++ if include_trace:+ helpful_msg += f'\n\nFull stacktrace:\n{traceback.format_exc()}'++ return helpful_msg+if include_trace:return f'{str(error)}\nStacktrace:\n{traceback.format_exc()}'return f'{str(error)}'