Skip to content

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

Update observability decorators in service classes

Magnus Müller1eb6ea28c049
diff --git a/browser_use/agent/message_manager/service.py b/browser_use/agent/message_manager/service.py
index a7b283dc4..6ef3e64b6 100644
--- a/browser_use/agent/message_manager/service.py
+++ b/browser_use/agent/message_manager/service.py
@@ -247,7 +247,7 @@ class MessageManager:
return ''
- @observe_debug(name='add_state_message')
+ @observe_debug(name='add_state_message', ignore_input=True)
@time_execution_sync('--add_state_message')
def add_state_message(
self,
diff --git a/browser_use/agent/service.py b/browser_use/agent/service.py
index b4bf68f5b..ac61a3d8c 100644
--- a/browser_use/agent/service.py
+++ b/browser_use/agent/service.py
@@ -615,7 +615,7 @@ class Agent(Generic[Context, AgentStructuredOutput]):
# self.logger.debug('Agent paused after getting state')
raise InterruptedError
- @observe_debug(name='get_browser_state_with_recovery')
+ @observe_debug(name='get_browser_state_with_recovery', ignore_output=True)
async def _get_browser_state_with_recovery(self, cache_clickable_elements_hashes: bool = True) -> BrowserStateSummary:
"""Get browser state with multiple fallback strategies for error recovery"""
diff --git a/browser_use/browser/session.py b/browser_use/browser/session.py
index c0421439b..2624efb53 100644
--- a/browser_use/browser/session.py
+++ b/browser_use/browser/session.py
@@ -2924,7 +2924,7 @@ class BrowserSession(BaseModel):
return self._cached_browser_state_summary
- @observe_debug(name='get_minimal_state_summary')
+ @observe_debug(name='get_minimal_state_summary', ignore_output=True)
@require_initialization
@time_execution_async('--get_minimal_state_summary')
async def get_minimal_state_summary(self) -> BrowserStateSummary:
@@ -2972,7 +2972,7 @@ class BrowserSession(BaseModel):
browser_errors=[f'Page state retrieval failed, minimal recovery applied for {url}'],
)
- @observe_debug(name='get_updated_state')
+ @observe_debug(name='get_updated_state', ignore_output=True)
async def _get_updated_state(self, focus_element: int = -1) -> BrowserStateSummary:
"""Update and return state."""
@@ -4102,7 +4102,7 @@ class BrowserSession(BaseModel):
str(self.id)[-4:],
)
- @observe_debug(name='get_state_summary_with_fallback')
+ @observe_debug(name='get_state_summary_with_fallback', ignore_output=True)
@require_initialization
@time_execution_async('--get_state_summary_with_fallback')
async def get_state_summary_with_fallback(self, cache_clickable_elements_hashes: bool = True) -> BrowserStateSummary: