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
Remove retry delay for rate limits, because we do this inside the llm call
Magnus Müllerf8a281fc353c
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.pyindex 8be33e315..fd5916ae8 100644--- a/browser_use/agent/service.py+++ b/browser_use/agent/service.py@@ -156,7 +156,6 @@ class Agent(Generic[Context, AgentStructuredOutput]):save_conversation_path: str | Path | None = None,save_conversation_path_encoding: str | None = 'utf-8',max_failures: int = 3,- retry_delay: int = 10,override_system_message: str | None = None,extend_system_message: str | None = None,validate_output: bool = False,@@ -233,7 +232,6 @@ class Agent(Generic[Context, AgentStructuredOutput]):save_conversation_path=save_conversation_path,save_conversation_path_encoding=save_conversation_path_encoding,max_failures=max_failures,- retry_delay=retry_delay,override_system_message=override_system_message,extend_system_message=extend_system_message,validate_output=validate_output,@@ -796,22 +794,7 @@ class Agent(Generic[Context, AgentStructuredOutput]):parse_hint = 'Your response could not be parsed. Return a valid JSON object with the required fields.'# self._message_manager._add_context_message(UserMessage(content=parse_hint))else:- from anthropic import RateLimitError as AnthropicRateLimitError- from google.api_core.exceptions import ResourceExhausted- from openai import RateLimitError-- # Define a tuple of rate limit error types for easier maintenance- RATE_LIMIT_ERRORS = (- RateLimitError, # OpenAI- ResourceExhausted, # Google- AnthropicRateLimitError, # Anthropic- )-- if isinstance(error, RATE_LIMIT_ERRORS) or 'on tokens per minute (TPM): Limit' in error_msg:- logger.warning(f'{prefix}{error_msg}')- await asyncio.sleep(self.settings.retry_delay)- else:- self.logger.error(f'{prefix}{error_msg}')+ self.logger.error(f'{prefix}{error_msg}')self.state.last_result = [ActionResult(error=error_msg)]return Nonediff --git a/browser_use/agent/views.py b/browser_use/agent/views.pyindex f1b7c1120..3b024d1f5 100644--- a/browser_use/agent/views.py+++ b/browser_use/agent/views.py@@ -35,7 +35,6 @@ class AgentSettings(BaseModel):save_conversation_path: str | Path | None = Nonesave_conversation_path_encoding: str | None = 'utf-8'max_failures: int = 3- retry_delay: int = 10validate_output: bool = Falsegenerate_gif: bool | str = Falseoverride_system_message: str | None = None