Skip to content

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

make sure get_state_summary always has an initialized browser_context

Nick Sweetingb4d9e1d9e20a
diff --git a/browser_use/browser/session.py b/browser_use/browser/session.py
index 2aaf9d91c..3c9cf213c 100644
--- a/browser_use/browser/session.py
+++ b/browser_use/browser/session.py
@@ -2200,7 +2200,8 @@ class BrowserSession(BaseModel):
structure = await page.evaluate(debug_script)
return structure
- @time_execution_sync('--get_state_summary') # This decorator might need to be updated to handle async
+ @require_initialization
+ @time_execution_sync('--get_state_summary')
async def get_state_summary(self, cache_clickable_elements_hashes: bool) -> BrowserStateSummary:
"""Get a summary of the current browser state