Skip to content

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

Fix AgentHookFunc type to be awaitable to correctly reflect usage of await on_step_start(self) and await on_step_end(self) in the agent service

Alezander9a03aa443de3d
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index 9b99c7b54..1d0fec843 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -83,7 +83,7 @@ def log_response(response: AgentOutput) -> None:
Context = TypeVar('Context')
-AgentHookFunc = Callable[['Agent'], None]
+AgentHookFunc = Callable[['Agent'], Awaitable[None]]
class Agent(Generic[Context]):