Thread-aware browser tools that work with the browser session manager.
Asynchronously get the current page of the browser.
Get the current page of the browser. Args: browser: The browser to get the current page from.
Build a session key from RunnableConfig.
checkpoint_ns_scope controls how much of checkpoint_ns is used:
"full" (default): append the entire checkpoint_ns, so every tool
call gets its own session."parent": drop the innermost (per-tool-call) checkpoint_ns segment
and append only the enclosing scope.Examples::
Top-level agent (ns "tools:abc"):
full -> "thread-001:tools:abc"
parent -> "thread-001"
Subagent (ns "sub-a:1|tools:xyz"):
full -> "thread-001:sub-a:1|tools:xyz"
parent -> "thread-001:sub-a:1"
Create thread-aware browser tools that use the session manager.
Manages browser sessions for different threads.
This class maintains separate browser sessions for different threads, enabling concurrent usage of browsers in multi-threaded environments. Browsers are created lazily only when needed by tools.
Concurrency protection is also implemented. Each browser session is tied
to a specific thread_id and includes protection against concurrent usage.
When a browser is obtained via get_async_browser() or get_sync_browser(),
it is marked as "in use", and subsequent attempts to access the same
browser session will raise a RuntimeError until it is released. In general,
different callers should use different thread_ids to avoid concurrency issues.
Input for NavigateTool.
Input for ClickTool.
Input for GetElementsTool.
Input for ExtractTextTool.
Input for ExtractHyperlinksTool.
Input for NavigateBackTool.
Input for CurrentWebPageTool.
Input for TypeTextTool.
Input for ScreenshotTool.
Input for ScrollTool.
Input for WaitForElementTool.
Base class for thread-aware browser tools.
Tool for navigating a browser to a URL with thread support.
Tool for clicking on an element with the given CSS selector.
Tool for typing text into input fields on a webpage.
Tool for capturing screenshots of the current webpage.
Tool for scrolling the webpage.
Tool for waiting until an element appears or reaches a specific state.