Skip to content

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

Renaming before_step_func and after_step_func to on_step_start and on_step_end.

Carlos Andrés Planchón Prestesa1c0719ee2eb
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index b561105a1..a65e10042 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -679,14 +679,14 @@ class Agent(Generic[Context]):
if self.state.stopped: # Allow stopping while paused
break
- if before_step_func is not None:
- await before_step_func(self)
+ if on_step_start is not None:
+ await on_step_start(self)
step_info = AgentStepInfo(step_number=step, max_steps=max_steps)
await self.step(step_info)
- if after_step_func is not None:
- await after_step_func(self)
+ if on_step_end is not None:
+ await on_step_end(self)
if self.state.history.is_done():
if self.settings.validate_output and step < max_steps - 1: