Skip to content

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

Refactor: Use configurable step timeout

Cursor Agent15e7fd6eec5d
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index 2cc319525..f943ab5d7 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -1776,12 +1776,12 @@ class Agent(Generic[Context, AgentStructuredOutput]):
try:
await asyncio.wait_for(
self.step(step_info),
- timeout=180, # 3 minute timeout
+ timeout=self.settings.step_timeout,
)
self.logger.debug(f'✅ Completed step {step + 1}/{max_steps}')
except TimeoutError:
# Handle step timeout gracefully
- error_msg = f'Step {step + 1} timed out after 180 seconds'
+ error_msg = f'Step {step + 1} timed out after {self.settings.step_timeout} seconds'
self.logger.error(f'⏰ {error_msg}')
await self._demo_mode_log(error_msg, 'error', {'step': step + 1})
self.state.consecutive_failures += 1