Skip to main content
Examples:
  • deterministic clicks
  • file handling
  • calling APIs
  • human-in-the-loop
  • browser interactions
  • calling LLMs
  • get 2fa codes
  • send emails
  • Playwright integration (see GitHub example)
Simply add @tools.action(...) to your function.
  • description (required) - What the tool does, the LLM uses this to decide when to call it.
  • allowed_domains - List of domains where tool can run (e.g. ['*.example.com']), defaults to all domains
The Agent fills your function parameters based on their names, type hints, & defaults.

Available Objects

Your function has access to these objects:
  • browser_session: BrowserSession - Current browser session for CDP access
  • cdp_client - Direct Chrome DevTools Protocol client
  • page_extraction_llm: BaseChatModel - The LLM you pass into agent. This can be used to do a custom llm call here.
  • file_system: FileSystem - File system access
  • available_file_paths: list[str] - Available files for upload/processing
  • has_sensitive_data: bool - Whether action contains sensitive data

Browser Interaction Examples

You can use browser_session to directly interact with page elements using CSS selectors:
Available methods on Page:
  • get_elements_by_css_selector(selector: str) - Returns list of matching elements
  • get_element_by_prompt(prompt: str, llm) - Returns element or None using LLM
  • must_get_element_by_prompt(prompt: str, llm) - Returns element or raises error
Available methods on Element:
  • click() - Click the element
  • type(text: str) - Type text into the element
  • get_text() - Get element text content
  • See openbrowser/actor/element.py for more methods

Pydantic Input

You can use Pydantic for the tool parameters:

Domain Restrictions

Limit tools to specific domains:

Advanced Example

For a comprehensive example of custom tools with Playwright integration, see: Playwright Integration Example This shows how to create custom actions that use Playwright’s precise browser automation alongside OpenBrowser.