Skip to main content
Browserbase provides remote browser infrastructure to make deployment of agentic browsing agents easy. Use it when running agent-browser in environments where a local browser isn’t feasible.

When to Use Browserbase

  • Serverless environments (AWS Lambda, Vercel Functions, etc.)
  • CI/CD pipelines
  • Distributed agent deployments
  • Environments without display server (headless VPS)
  • Need for session recording and debugging

Prerequisites

Setup

1

Get your credentials

  1. Visit the Browserbase Dashboard
  2. Copy your API Key
  3. Copy your Project ID
2

Set environment variables

export BROWSERBASE_API_KEY="your-api-key"
export BROWSERBASE_PROJECT_ID="your-project-id"

Usage

Via CLI Flag

Use the -p browserbase flag:
agent-browser -p browserbase open https://example.com
agent-browser -p browserbase snapshot -i
agent-browser -p browserbase click @e1

Via Environment Variable

Set the provider globally:
export AGENT_BROWSER_PROVIDER=browserbase
export BROWSERBASE_API_KEY="your-api-key"
export BROWSERBASE_PROJECT_ID="your-project-id"

# Now all commands use Browserbase automatically
agent-browser open https://example.com
agent-browser snapshot -i
agent-browser click @e1

Features

When using Browserbase, all standard agent-browser commands work identically:
  • Navigation (open, back, forward, reload)
  • Snapshots with refs (snapshot -i)
  • Interactions (click, fill, type, press)
  • Screenshots (screenshot, screenshot --full)
  • State management (state save, state load)
  • Network control (network route, network requests)

Environment Variables

VariableDescriptionRequired
AGENT_BROWSER_PROVIDERSet to browserbaseYes (or use -p flag)
BROWSERBASE_API_KEYYour Browserbase API keyYes
BROWSERBASE_PROJECT_IDYour Browserbase project IDYes

Example: Serverless Deployment

#!/bin/bash
# deploy.sh - Run browser automation in serverless environment

export AGENT_BROWSER_PROVIDER=browserbase
export BROWSERBASE_API_KEY="$BROWSERBASE_KEY"  # From secrets
export BROWSERBASE_PROJECT_ID="$BROWSERBASE_PROJECT"

# Run automation workflow
agent-browser open https://app.example.com/login
agent-browser snapshot -i
agent-browser fill @e1 "$USERNAME"
agent-browser fill @e2 "$PASSWORD"
agent-browser click @e3
agent-browser wait --url "**/dashboard"
agent-browser screenshot result.png
agent-browser close

Example: CI/CD Pipeline

# .github/workflows/e2e-test.yml
name: E2E Tests

on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      
      - name: Install agent-browser
        run: npm install -g agent-browser
      
      - name: Run tests
        env:
          AGENT_BROWSER_PROVIDER: browserbase
          BROWSERBASE_API_KEY: ${{ secrets.BROWSERBASE_API_KEY }}
          BROWSERBASE_PROJECT_ID: ${{ secrets.BROWSERBASE_PROJECT_ID }}
        run: |
          agent-browser open https://staging.example.com
          agent-browser snapshot -i
          agent-browser click @e1
          agent-browser screenshot test-result.png

Session Recording

Browserbase automatically records all sessions. View recordings in your Browserbase Dashboard for debugging.

Pricing

Check current pricing at browserbase.com/pricing.
All agent-browser commands work identically whether you’re using a local browser or Browserbase. Simply set the provider and your automation scripts run unchanged.

Build docs developers (and LLMs) love