Skip to content

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

fix: type-narrow actions instead of assert (fixes pyright + test compat)

ShawnPana92181538d301
diff --git a/browser_use/skill_cli/commands/browser.py b/browser_use/skill_cli/commands/browser.py
index 380f41197..221e45aad 100644
--- a/browser_use/skill_cli/commands/browser.py
+++ b/browser_use/skill_cli/commands/browser.py
@@ -82,6 +82,8 @@ async def handle(action: str, session: SessionInfo, params: dict[str, Any]) -> A
"""Handle browser control command."""
bs = session.browser_session
actions = session.actions
+ if actions is None:
+ return {'error': 'ActionHandler not initialized'}
if action == 'open':
url = params['url']