Browserbase
BrowserbaseTools enable an Agent to automate browser interactions using Browserbase, a headless browser service.
Prerequisites
The following example requires Browserbase API credentials after you signup here, and the Playwright library.
1uv pip install browserbase playwright2export BROWSERBASE_API_KEY=xxx3export BROWSERBASE_PROJECT_ID=xxxExample
The following agent will use Browserbase to visit https://quotes.toscrape.com and extract content. Then navigate to page two of the website and get quotes from there as well.
1from kern.agent import Agent2from kern.tools.browserbase import BrowserbaseTools34agent = Agent(5 name="Web Automation Assistant",6 tools=[BrowserbaseTools()],7 instructions=[8 "You are a web automation assistant that can help with:",9 "1. Capturing screenshots of websites",10 "2. Extracting content from web pages",11 "3. Monitoring website changes",12 "4. Taking visual snapshots of responsive layouts",13 "5. Automated web testing and verification",14 ],15 markdown=True,16)1718agent.print_response("""19 Visit https://quotes.toscrape.com and:20 1. Extract the first 5 quotes and their authors21 2. Navigate to page 222 3. Extract the first 5 quotes from page 223""")TipView the Startup Analyst MCP agent
Toolkit Params
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | str | None | Browserbase API key. If not provided, uses BROWSERBASE_API_KEY env var. |
project_id | str | None | Browserbase project ID. If not provided, uses BROWSERBASE_PROJECT_ID env var. |
base_url | str | None | Custom Browserbase API endpoint URL. Only use this if you're using a self-hosted Browserbase instance or need to connect to a different region. If not provided, uses BROWSERBASE_BASE_URL env var. |
enable_navigate_to | bool | True | Enable the navigate_to functionality. |
enable_screenshot | bool | True | Enable the screenshot functionality. |
enable_get_page_content | bool | True | Enable the get_page_content functionality. |
enable_close_session | bool | True | Enable the close_session functionality. |
all | bool | False | Enable all functionality. |
Toolkit Functions
| Function | Description |
|---|---|
navigate_to | Navigates to a URL. Takes a URL and an optional connect_url parameter. |
screenshot | Takes a screenshot of the current page. Takes a path to save the screenshot, a boolean for full-page capture, and an optional connect_url parameter. |
get_page_content | Gets the HTML content of the current page. Takes an optional connect_url parameter. |
close_session | Closes a browser session. |
Developer Resources
- View Tools