> ## 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.

# Observability

> Debug and monitor your browser sessions with logs, metrics, and real-time inspection

<CardGroup cols={3}>
  <Card title="Session Live View" icon="tower-broadcast" href="/platform/browser/observability/session-live-view">
    Watch and interact with browser sessions in real-time as they run.
  </Card>

  <Card title="Session Recording" icon="video" href="/platform/browser/observability/session-recording">
    Replay every session as a video recording to debug issues after the fact.
  </Card>

  <Card title="Session Replay" icon="play" href="/platform/browser/observability/session-replay">
    Stream session replays as HLS to embed playback in your own application.
  </Card>
</CardGroup>

Browserbase provides comprehensive observability tools to debug and monitor your browser sessions. Access these tools through the Session Inspector in the Dashboard or retrieve data programmatically via the API.

The Session Inspector is accessible by clicking any session in the [Dashboard](https://www.browserbase.com/sessions).

## Dashboard

### Video recordings

Every session is automatically captured as a video recording, supporting up to 10 tabs. Video recordings are available in the Session Inspector for playback and debugging.

<Frame>
  <img src="https://mintcdn.com/browserbase/giE_cpy18f2mWHqr/images/features/session_recording.png?fit=max&auto=format&n=giE_cpy18f2mWHqr&q=85&s=0724a3482590f949af570dd8ecce9f6b" alt="" width="2900" height="1864" data-path="images/features/session_recording.png" />
</Frame>

<Card title="Session Replay" icon="play" href="/platform/browser/observability/session-replay">
  To embed playback in your own application, stream session replays as HLS through the Session Replay API.
</Card>

### Live view

Debug running sessions in real-time using the Live Debug URL.

<Frame>
  <img src="https://mintcdn.com/browserbase/giE_cpy18f2mWHqr/images/session-debugger/livedebugurl.png?fit=max&auto=format&n=giE_cpy18f2mWHqr&q=85&s=5451af1ee36b91796c650d9992589183" alt="" width="3426" height="2042" data-path="images/session-debugger/livedebugurl.png" />
</Frame>

The `Copy Debug URL` button appears in the Session Inspector when a session is actively running.

<Frame>
  <img src="https://mintcdn.com/browserbase/giE_cpy18f2mWHqr/images/session-debugger/runningstatus.png?fit=max&auto=format&n=giE_cpy18f2mWHqr&q=85&s=90375b39118f0b1134ee230e26ba286d" alt="" width="314" height="142" data-path="images/session-debugger/runningstatus.png" />
</Frame>

For more on Live View, see [Session Live View](/platform/browser/observability/session-live-view).

### Status bar

The Status Bar displays session metadata and status information.

<Frame>
  <img src="https://mintcdn.com/browserbase/giE_cpy18f2mWHqr/images/session-debugger/status-bar.png?fit=max&auto=format&n=giE_cpy18f2mWHqr&q=85&s=d2ef904e221d72fa6e9a903d6395e925" alt="" width="2364" height="138" data-path="images/session-debugger/status-bar.png" />
</Frame>

| Property                                      | Description                                                                   |
| --------------------------------------------- | ----------------------------------------------------------------------------- |
| Session ID                                    | Unique identifier for the session                                             |
| Status                                        | Current status and termination reason if applicable                           |
| Started                                       | Session start timestamp                                                       |
| [Region](/optimizations/latency/multi-region) | Region where the session ran                                                  |
| Duration                                      | Total session length                                                          |
| [Proxy Bandwidth](/platform/identity/proxies) | Data transferred through proxy (MB). Only displayed when proxies are enabled. |
| Settings                                      | Session configuration (e.g., `keepAlive`, `context`)                          |
| User Metadata                                 | Custom metadata attached to the session                                       |
| Extension ID                                  | Identifier for any browser extension used                                     |
| Expires                                       | When the session data expires and is deleted                                  |

### Events and pages

The Events view shows a timeline of activity during the session.

<Frame>
  <img src="https://mintcdn.com/browserbase/giE_cpy18f2mWHqr/images/session-debugger/eventspages.png?fit=max&auto=format&n=giE_cpy18f2mWHqr&q=85&s=7b1136ec5a3f751e04f3f23f50b570bb" alt="" width="2902" height="804" data-path="images/session-debugger/eventspages.png" />
</Frame>

This view includes:

* Pages loaded during the session
* CDP events (`Runtime.*`, `Page.*`, `Input.*`, `Log.*`)
* Network requests and responses

### Stagehand

The Stagehand tab provides inspection tools for sessions created with [Stagehand](https://www.stagehand.dev/).

<Frame>
  <img src="https://mintcdn.com/browserbase/lUkHCCQ3HJMpCnfp/images/session-debugger/stagehandtab.jpeg?fit=max&auto=format&n=lUkHCCQ3HJMpCnfp&q=85&s=2b4837d969c934c4342eebd7914ce40b" alt="" width="1742" height="813" data-path="images/session-debugger/stagehandtab.jpeg" />
</Frame>

Click any row to expand details:

<Frame>
  <img src="https://mintcdn.com/browserbase/lUkHCCQ3HJMpCnfp/images/session-debugger/stagehandrow.jpeg?fit=max&auto=format&n=lUkHCCQ3HJMpCnfp&q=85&s=0eefd278843ad7637181885551582990" alt="" width="1742" height="997" data-path="images/session-debugger/stagehandrow.jpeg" />
</Frame>

Available information:

* Token usage
* Execution time
* Extraction schemas
* Execution results

For `extract` calls, switch between JSON and [Zod](https://zod.dev/) schema formats:

<Frame>
  <img src="https://mintcdn.com/browserbase/lUkHCCQ3HJMpCnfp/images/session-debugger/stagehandextract.png?fit=max&auto=format&n=lUkHCCQ3HJMpCnfp&q=85&s=edcbbe882b7a7608f207ea947864c51d" alt="" width="1028" height="800" data-path="images/session-debugger/stagehandextract.png" />
</Frame>

### Console logs

View browser console logs emitted by the [Web Console API](https://developer.mozilla.org/en-US/docs/Web/API/console) (`console.log()`, `console.error()`, etc.). These are logs generated by JavaScript running on the page.

<Frame>
  <img src="https://mintcdn.com/browserbase/m1Ny8qOvNHvtrY7y/images/session-debugger/console.png?fit=max&auto=format&n=m1Ny8qOvNHvtrY7y&q=85&s=f2939354616758b1e380bd2b4121524d" alt="" width="2648" height="428" data-path="images/session-debugger/console.png" />
</Frame>

Common console messages:

* `browser-solving-started` / `browser-solving-completed` - Captcha solving events
* `Starting recording` - Recording initialization

### Network logs

View all HTTP network requests and responses captured via Chrome DevTools Protocol ([`Network`](https://chromedevtools.github.io/devtools-protocol/tot/Network/) events).

<Frame>
  <img src="https://mintcdn.com/browserbase/Qn5OB0mYcUstQ-qY/images/session-debugger/network.png?fit=max&auto=format&n=Qn5OB0mYcUstQ-qY&q=85&s=0baffff5a174078834879b73dbabaaec" alt="" width="2472" height="1732" data-path="images/session-debugger/network.png" />
</Frame>

Use network logs to:

* Debug failed requests
* Analyze proxy bandwidth usage
* Identify slow or blocked resources

## Session logs API

Retrieve session logs programmatically for automated processing or custom tooling. The Session Logs API returns CDP (Chrome DevTools Protocol) events including console logs, network activity, and page lifecycle events.

<Tabs>
  <Tab title="Node.js">
    ```typescript theme={null}
    import { Browserbase } from "@browserbasehq/sdk";

    const bb = new Browserbase({ apiKey: process.env.BROWSERBASE_API_KEY! });

    const logs = await bb.sessions.logs.list(sessionId);
    console.log(logs);
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    from browserbase import Browserbase
    import os

    bb = Browserbase(api_key=os.environ["BROWSERBASE_API_KEY"])

    logs = bb.sessions.logs.list(session_id)
    print(logs)
    ```
  </Tab>

  <Tab title="cURL">
    ```bash theme={null}
    curl https://api.browserbase.com/v1/sessions/<session-id>/logs \
      -H "X-BB-API-Key: $BROWSERBASE_API_KEY"
    ```
  </Tab>
</Tabs>

See [Sessions API](/reference/api/session-logs) for more details.

## HAR recording

HAR (HTTP Archive) files capture detailed network activity for offline analysis. Use Playwright's tracing feature to record HAR data locally.

<Tabs>
  <Tab title="Node.js">
    ```typescript theme={null}
    import { Browserbase } from "@browserbasehq/sdk";
    import { chromium } from "playwright-core";

    const bb = new Browserbase({ apiKey: process.env.BROWSERBASE_API_KEY! });

    const session = await bb.sessions.create();

    const browser = await chromium.connectOverCDP(session.connectUrl);
    const context = browser.contexts()[0];
    const page = context.pages()[0];

    // Start HAR recording
    const harFile = `recording-${Date.now()}.har`;
    await context.routeFromHAR(harFile, {
      url: "**/*",
      update: true,
      updateContent: "embed",
      updateMode: "full"
    });

    // Start tracing for local network capture
    await context.tracing.start({
      screenshots: true,
      snapshots: true,
      sources: true
    });

    await page.goto("https://news.ycombinator.com");

    // Stop tracing and save
    const traceFile = `trace-${Date.now()}.zip`;
    await context.tracing.stop({ path: traceFile });

    await page.close();
    await browser.close();

    console.log(`HAR: ${harFile}, Trace: ${traceFile}`);
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    from browserbase import Browserbase
    from playwright.sync_api import sync_playwright
    import os
    import time

    bb = Browserbase(api_key=os.environ["BROWSERBASE_API_KEY"])

    session = bb.sessions.create()

    with sync_playwright() as p:
        browser = p.chromium.connect_over_cdp(session.connect_url)
        context = browser.contexts[0]
        page = context.pages[0]

        # Start HAR recording
        har_file = f"recording-{int(time.time())}.har"
        context.route_from_har(har_file, url="**/*", update=True,
                               update_content="embed", update_mode="full")

        # Start tracing for local network capture
        context.tracing.start(screenshots=True, snapshots=True, sources=True)

        page.goto("https://news.ycombinator.com")

        # Stop tracing and save
        trace_file = f"trace-{int(time.time())}.zip"
        context.tracing.stop(path=trace_file)

        page.close()
        browser.close()

    print(f"HAR: {har_file}, Trace: {trace_file}")
    ```
  </Tab>
</Tabs>

View trace files with: `npx playwright show-trace trace-file.zip`

<Note>
  HAR files created with `routeFromHAR` are stored on the remote instance. Use tracing to capture network data locally.
</Note>

## Capturing browser console logs

You can capture browser console logs programmatically during your session using Playwright's console event listener. This gives you real-time access to `console.log()`, `console.error()`, and other Web Console API calls as they happen.

<Tabs>
  <Tab title="Node.js">
    ```typescript theme={null}
    import { Browserbase } from "@browserbasehq/sdk";
    import { chromium } from "playwright-core";

    const bb = new Browserbase({ apiKey: process.env.BROWSERBASE_API_KEY! });

    const session = await bb.sessions.create();

    const browser = await chromium.connectOverCDP(session.connectUrl);
    const context = browser.contexts()[0];
    const page = context.pages()[0];

    // Capture console logs
    page.on("console", (msg) => {
      console.log(`[${msg.type()}] ${msg.text()}`);
    });

    await page.goto("https://news.ycombinator.com");

    await page.close();
    await browser.close();
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    from browserbase import Browserbase
    from playwright.sync_api import sync_playwright
    import os

    bb = Browserbase(api_key=os.environ["BROWSERBASE_API_KEY"])

    session = bb.sessions.create()

    with sync_playwright() as p:
        browser = p.chromium.connect_over_cdp(session.connect_url)
        context = browser.contexts[0]
        page = context.pages[0]

        # Capture console logs
        page.on("console", lambda msg: print(f"[{msg.type}] {msg.text}"))

        page.goto("https://news.ycombinator.com")

        page.close()
        browser.close()
    ```
  </Tab>
</Tabs>

## Debugging tips

| Issue                           | Solution                                                                                    |
| ------------------------------- | ------------------------------------------------------------------------------------------- |
| Session terminated unexpectedly | Check Status Bar for termination reason                                                     |
| Selector not found              | Use DOM view to inspect element state at failure point                                      |
| Network request failed          | Check Network tab for status codes and response details                                     |
| Bot protection issues           | Review console logs for solving events, check [Agent Identity](/platform/identity/overview) |

<Note>
  Questions? Email [support@browserbase.com](mailto:support@browserbase.com)
</Note>
