Skip to main content

BrowserNonVisualToolkit

A lightweight, non-visual browser toolkit exposing primitive Playwright actions as CAMEL FunctionTools.

init

del

Best-effort cleanup when toolkit is garbage collected.
  1. We avoid running during the Python interpreter shutdown phase (sys.is_finalizing()), because the import machinery and/or event loop may already be torn down which leads to noisy exceptions such as ImportError: sys.meta_path is None or RuntimeError: Event loop is closed.
  2. We protect all imports and event-loop operations with defensive try/except blocks. This ensures that, even if cleanup cannot be carried out, we silently ignore the failure instead of polluting stderr on program exit.

_validate_ref

Validate that ref parameter is a non-empty string.

_ensure_agent

Create PlaywrightLLMAgent on first use if web_agent_model provided.

get_tools