browserbase-sessions

SkillDB 作者 custom v2.5.0

Create and manage persistent Browserbase cloud browser sessions with authentication persistence. Use when you need to automate browsers, maintain logged-in sessions across interactions, scrape authenticated pages, or manage cloud browser instances.

源码 ↗

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install skilldb:jamesfincher~browserbase-sessions
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/skilldb%3Ajamesfincher~browserbase-sessions/file -o browserbase-sessions.md
Git 仓库获取源码
git clone https://github.com/openclaw/skills/commit/9b397f4064fb6fd12918f2f88dc7c6e7509084ed
# Browserbase Sessions Skill

Manage persistent cloud browser sessions via Browserbase. This skill creates browser sessions that preserve authentication (cookies, local storage) across interactions, automatically solve CAPTCHAs, and record sessions for later review.

## Agent Checklist (Be Proactive)

- If `BROWSERBASE_API_KEY` or `BROWSERBASE_PROJECT_ID` is missing, **ask the user for them** (and tell them where to find them). Do not run Browserbase commands until both are configured.
- If commands fail due to missing Python deps (ImportError for `browserbase` / `playwright`), run:
  - `python3 {baseDir}/scripts/browserbase_manager.py install`
  - Then retry the original command.
- Ask the user what they want to persist and how they want to organize it:
  - **Workspace per app/site** (isolation): `github`, `slack`, `stripe`
  - **Workspace per task/project** (multi-site workflow): `invoice-run`, `lead-gen`, `expense-recon`
- Workspaces persist:
  - Login state via Browserbase **Contexts** (cookies + storage)
  - Open tabs (URL + title snapshot) so you can restore where you left off
- Prefer workspace commands (`create-workspace`, `start-workspace`, `resume-workspace`, `stop-workspace`) over raw session commands when the user wants the browser to stay open across chat turns.
- Prefer direct interaction commands (`list-tabs`, `new-tab`, `switch-tab`, `close-tab`, `click`, `type`, `press`, `wait-for`, `go-back`, `go-forward`, `reload`, `read-page`) before falling back to `execute-js`.
- If a workspace/session has a `pending_handoff`, **check it first** before doing anything else:
  - `python3 {baseDir}/scripts/browserbase_manager.py handoff --action check --workspace <ws>`
  - If not done, resend `suggested_user_message` and stop.
- Whenever a browser is opened (`start-workspace`, `resume-workspace`, or `create-session`), immediately share the human remote-control link:
  - Prefer `human_handoff.share_url` from command output.
  - Prefer `human_handoff.share_text` / `human_handoff.share_markdown` when replying to the user.
  - Fallback to `human_control_url`.
  - If missing, run `live-url` and share its `human_handoff.share_url`.
- When you need the user to perform a manual step (SSO/MFA/captcha/consent screens), use a **handoff with a completion check**:
  - Set: `python3 {baseDir}/scripts/browserbase_manager.py handoff --action set --workspace <ws> --instructions "<what to do>" --url-contains "<post-step url fragment>"` (or `--selector/--text/--cookie-name/...`)
  - Verify later: `python3 {baseDir}/scripts/browserbase_manager.py handoff --action check --workspace <ws>` (or `--action wait`)
- When closing, use `stop-workspace` (not `terminate-session`) so tabs are snapshotted and auth state is persisted.

## Prompt-Optimized Response Patterns

Use short, consistent responses so users always know next actions.

When credentials are missing:
```text
I need your Browserbase credentials before I can open a browser.
Please provide:
1) BROWSERBASE_API_KEY
2) BROWSERBASE_PROJECT_ID
```

When browser is opened (session/workspace):
```text
Browser is ready.
<human_handoff.share_text>
I can keep working while you browse.
```

When resuming an existing workspace:
```text
Reconnected to your existing workspace.
<human_handoff.share_text>
```

When a human step is required (SSO/MFA/consent screens):
```text
I need you to do one step in the live browser:
1) <exact steps>

Open: <human_handoff.share_url>
Stop when you reach: <a specific completion state (URL contains / selector visible)>.
I’ll detect it and continue automatically. If I don’t, reply “done” and I’ll re-check.
```

When live URL is temporarily unavailable:
```text
The remote-control URL is temporarily unavailable. I’ll retry now.
```

## First-Time Setup

### Step 1 — Get your Browserbase credentials

1. Sign up at [browserbase.com](https://www.browserbase.com/) if you haven't already.
2. Go to **Settings → API Keys** and copy your API key (starts with `bb_live_`).
3. Go to **Settings → Project** and copy your Project ID (a UUID).

If you have the API key but aren’t sure which Project ID to use, you can list projects:

```bash
export BROWSERBASE_API_KEY="bb_live_your_key_here"
python3 {baseDir}/scripts/browserbase_manager.py list-projects
```

### Step 2 — Install dependencies

Install Python deps and Playwright Chromium (recommended):

```bash
python3 {baseDir}/scripts/browserbase_manager.py install
```

Manual alternative (pip/uv):

```bash
cd {baseDir}/scripts && pip install -r requirements.txt
python3 -m playwright install chromium
```

### Step 3 — Set environment variables

```bash
export BROWSERBASE_API_KEY="bb_live_your_key_here"
export BROWSERBASE_PROJECT_ID="your-project-uuid-here"
```

Or configure via OpenClaw's `skills.entries["browserbase-sessions"].env` in `~/.openclaw/openclaw.json` (JSON5). Because this skill sets `primaryEnv: BROWSERBASE_API_KEY`, you can also use `skills.entries["browserbase-sessions"].apiKey` for the API key:

```json5
{
  skills: {
    entries: {
      "browserbase-sessions": {
        enabled: true,
        apiKey: "bb_live_your_key_here",
        env: {
          BROWSERBASE_PROJECT_ID: "your-project-uuid-here"
        }
      }
    }
  }
}
```

### Step 4 — Run the setup test

This validates everything end-to-end (credentials, SDK, Playwright, API connection, and a live smoke test):

```bash
python3 {baseDir}/scripts/browserbase_manager.py setup --install
```

You should see `"status": "success"` with all steps passing. If any step fails, the error message tells you exactly what to fix.

## Defaults

Every session is created with these defaults to support research workflows:

- **Captcha solving: ON** — Browserbase automatically solves CAPTCHAs so login flows and protected pages work without manual intervention. Disable with `--no-solve-captchas`.
- **Session recording: ON** — Browserbase records sessions (video in the Dashboard; rrweb events retrievable via API). Disable with `--no-record`.
- **Session logging: ON** — Browserbase captures session logs retrievable via API. Disable with `--no-logs`.
- **Auth persistence** — If you use a Context (or Workspace), auth state is persisted by default. Disable persistence with `--no-persist`.

## Capabilities & Limitations (Be Explicit)

The agent can:
- Create/inspect/terminate Browserbase sessions and contexts.
- Keep a browser “open” across chat turns using workspaces (keep-alive sessions + restore tabs).
- Persist login state across sessions via Browserbase Contexts (`persist=true`).
- Restore your place by reopening the last saved set of open tabs (URL + title snapshot).
- Provide a live debugger URL so the user can browse manually while the agent continues working.
- Use interactive browser controls: list/open/switch/close tabs, click/type/press keys, wait for selectors/text/url states, go back/forward/reload, and read page text/html/links.
- Take screenshots, run JavaScript, read cookies, fetch logs, and fetch rrweb recording events.

The agent cannot:
- Keep sessions running indefinitely (Browserbase enforces timeouts; max is 6 hours).
- Restore full back/forward browser history (only open URLs are restored).
- Passively “watch” what the user is doing in the live debugger. To detect human actions, the agent must reconnect and **check for specific completion conditions** (selector/text/url/cookie/storage) using `handoff` or `wait-for`.
- Bypass MFA/SSO without user participation.
- Download the Dashboard video via API (the API returns rrweb events, not a video file).

## Available Commands

All commands are run via the manager script:

```bash
python3 {baseDir}/scripts/browserbase_manager.py <command> [options]
```

### Setup & Validation

Install deps (only needed once per environment):
```bash
python3 {baseDir}/scripts/browserbase_manager.py install
```

Run the full setup test:
```bash
python3 {baseDir}/scripts/browserbase_manager.py setup --install
```

### Workspaces (Recommended)

Workspaces are the recom