Skip to main content


Browserbase is a developer platform to reliably run, manage, and monitor headless browsers.

Power your AI data retrievals with:

Installation and Setup

  • Get an API key and Project ID from and set it in environment variables (BROWSERBASE_API_KEY, BROWSERBASE_PROJECT_ID).
  • Install the Browserbase SDK:
% pip install browserbase

Loading documents

You can load webpages into LangChain using BrowserbaseLoader. Optionally, you can set text_content parameter to convert the pages to text-only representation.

from langchain_community.document_loaders import BrowserbaseLoader
API Reference:BrowserbaseLoader
loader = BrowserbaseLoader(
# Text mode

docs = loader.load()

Loader Options

  • urls Required. A list of URLs to fetch.
  • text_content Retrieve only text content. Default is False.
  • api_key Optional. Browserbase API key. Default is BROWSERBASE_API_KEY env variable.
  • project_id Optional. Browserbase Project ID. Default is BROWSERBASE_PROJECT_ID env variable.
  • session_id Optional. Provide an existing Session ID.
  • proxy Optional. Enable/Disable Proxies.

Loading images

You can also load screenshots of webpages (as bytes) for multi-modal models.

Full example using GPT-4V:

from browserbase import Browserbase
from browserbase.helpers.gpt4 import GPT4VImage, GPT4VImageDetail
from langchain_core.messages import HumanMessage
from langchain_openai import ChatOpenAI

chat = ChatOpenAI(model="gpt-4-vision-preview", max_tokens=256)
browser = Browserbase()

screenshot = browser.screenshot("")

result = chat.invoke(
{"type": "text", "text": "What color is the logo?"},

API Reference:HumanMessage | ChatOpenAI

Was this page helpful?

You can also leave detailed feedback on GitHub.