Skip to content

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

Checking if after_step_func is None.

Carlos Andrés Planchón Prestesded1addb95d7
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index 522f68cc5..ca356a829 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -530,7 +530,8 @@ class Agent(Generic[Context]):
await self.step()
- await after_step_func(self)
+ if after_step_func is not None:
+ await after_step_func(self)
if self.state.history.is_done():
if self.settings.validate_output and step < max_steps - 1: