> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/vercel-labs/agent-browser/llms.txt
> Use this file to discover all available pages before exploring further.

# Browserbase

> Cloud browser infrastructure for agent deployments

[Browserbase](https://browserbase.com) 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

* Browserbase account ([sign up](https://browserbase.com))
* API key and Project ID from [Browserbase Dashboard](https://browserbase.com/overview)

## Setup

<Steps>
  <Step title="Get your credentials">
    1. Visit the [Browserbase Dashboard](https://browserbase.com/overview)
    2. Copy your **API Key**
    3. Copy your **Project ID**
  </Step>

  <Step title="Set environment variables">
    ```bash theme={null}
    export BROWSERBASE_API_KEY="your-api-key"
    export BROWSERBASE_PROJECT_ID="your-project-id"
    ```
  </Step>
</Steps>

## Usage

### Via CLI Flag

Use the `-p browserbase` flag:

```bash theme={null}
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:

```bash theme={null}
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

<table>
  <thead>
    <tr>
      <th>Variable</th>
      <th>Description</th>
      <th>Required</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td><code>AGENT\_BROWSER\_PROVIDER</code></td>
      <td>Set to <code>browserbase</code></td>
      <td>Yes (or use <code>-p</code> flag)</td>
    </tr>

    <tr>
      <td><code>BROWSERBASE\_API\_KEY</code></td>
      <td>Your Browserbase API key</td>
      <td>Yes</td>
    </tr>

    <tr>
      <td><code>BROWSERBASE\_PROJECT\_ID</code></td>
      <td>Your Browserbase project ID</td>
      <td>Yes</td>
    </tr>
  </tbody>
</table>

## Example: Serverless Deployment

```bash theme={null}
#!/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

```yaml theme={null}
# .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](https://browserbase.com/sessions) for debugging.

## Pricing

Check current pricing at [browserbase.com/pricing](https://browserbase.com/pricing).

<Note>
  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.
</Note>
