> ## Documentation Index
> Fetch the complete documentation index at: https://docs.browserbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Browserbase CLI

> Use the Browserbase CLI skill to run `bb` workflows through Claude Code and other AI coding agents.

The `browserbase-cli` skill teaches AI coding agents how to use the official Browserbase CLI (`bb`). The CLI is the primary interface for managing Browserbase infrastructure — it covers Functions lifecycle, platform resource management, page fetching, and web search.

Use this skill when you want your agent to stay inside the CLI for tasks like:

* **Functions** — `bb functions init`, `dev`, `publish`, and `invoke` for the full browser agent deployment lifecycle
* **Sessions** — `bb sessions list`, `get`, `create`, `update`, `debug`, `logs`, `recording`, `downloads`, and `uploads` to manage browser sessions
* **Projects** — `bb projects list`, `get`, and `usage` for project-level configuration
* **Contexts** — `bb contexts create`, `get`, `update`, and `delete` to manage persistent browser state (cookies, localStorage)
* **Extensions** — `bb extensions upload`, `get`, and `delete` for custom browser extensions
* **Fetch** — `bb fetch <url>` to retrieve page content through Browserbase proxies with redirect control and JSON output
* **Search** — `bb search <query>` to search the web through the Browserbase Search API

<Info>
  The `browserbase-cli` skill is for `bb`-driven workflows. For interactive browser control like navigation, clicking, typing, and snapshots, use the `browser` skill instead.
</Info>

## Choose the right skill

| Skill             | Best for                                                                                             |
| ----------------- | ---------------------------------------------------------------------------------------------------- |
| `browser`         | Interactive browser automation with the `browse` CLI                                                 |
| `fetch`           | Lightweight page retrieval via the Browserbase Fetch API                                             |
| `functions`       | Focused Browserbase Functions workflows                                                              |
| `browserbase-cli` | Broader `bb` workflows across functions, sessions, projects, contexts, extensions, fetch, and search |

## Installation

<Tabs>
  <Tab title="Vercel Skills CLI">
    <Steps>
      <Step title="Install the skill">
        ```bash theme={null}
        npx skills add browserbase/skills --skill browserbase-cli
        ```
      </Step>

      <Step title="Install the Browserbase CLI">
        ```bash theme={null}
        npm install -g @browserbasehq/cli
        ```
      </Step>
    </Steps>
  </Tab>

  <Tab title="Claude Code Plugins">
    <Steps>
      <Step title="Add the Browserbase marketplace">
        ```bash theme={null}
        claude plugin marketplace add browserbase/skills
        ```
      </Step>

      <Step title="Install the browserbase-cli plugin">
        ```bash theme={null}
        claude plugin install browserbase-cli@browserbase --scope local
        ```
      </Step>

      <Step title="Install the Browserbase CLI">
        ```bash theme={null}
        npm install -g @browserbasehq/cli
        ```
      </Step>
    </Steps>
  </Tab>
</Tabs>

## Authentication

All `bb` commands require your API key:

```bash theme={null}
export BROWSERBASE_API_KEY="your_api_key"
```

## Common workflows

### Functions

```bash theme={null}
bb functions init my-function
cd my-function
bb functions dev index.ts
bb functions publish index.ts
bb functions invoke <function_id> --params '{"url":"https://example.com"}'
```

### Platform APIs

```bash theme={null}
bb projects list
bb sessions get <session_id>
bb contexts create --body '{"region":"us-west-2"}'
bb extensions upload ./my-extension.zip
```

### Fetch API

```bash theme={null}
bb fetch https://example.com
bb fetch https://example.com --allow-redirects --output page.html
```

### Search API

```bash theme={null}
bb search "best headless browser" --num-results 5
bb search "browser automation" --output results.json
```

## Notes on `bb browse`

`bb browse` is a passthrough to the standalone `browse` CLI. Use it only when you explicitly want to stay inside a `bb`-centric workflow.

For most interactive browsing tasks, prefer the `browser` skill directly.

If you need `bb browse`, install the `browse` CLI too:

```bash theme={null}
npm install -g @browserbasehq/browse-cli
```

## Further reading

<CardGroup cols={2}>
  <Card title="Skills Repository" icon="github" iconType="sharp-solid" href="https://github.com/browserbase/skills">
    View the Browserbase skills source and installation instructions.
  </Card>

  <Card title="Browserbase Functions" icon="cloud" iconType="sharp-solid" href="/platform/runtime/overview">
    Learn more about Browserbase Functions.
  </Card>
</CardGroup>
