Skip to main content

Overview

Chrome DevTools Protocol (CDP) is the raw browser debugging protocol built into Chrome and Chromium-based browsers. BAP sits above CDP, using Playwright as an intermediary, and adds agent-oriented abstractions.
AI Agent
  |
  v
BAP (semantic selectors, observe, act, extract, fusion)
  |
  v
Playwright (cross-browser abstraction)
  |
  v
CDP / Browser-specific protocol
  |
  v
Chrome / Firefox / WebKit

Comparison

DimensionBAPChrome DevTools / CDP
LevelAgent-ready workflow layerRaw browser debugging protocol
Selectors10 semantic types (role, text, label, ref, testId, …)Manual DOM queries, Runtime.evaluate
Multi-step actionsact batches steps with retry and conditionsCompose sequences yourself
ObservationStructured elements with refs, action hints, boundsRoll your own from Accessibility + DOM domains
Extractionextract with JSON SchemaCustom Runtime.evaluate scripts
Token efficiencyResponse tiers, fusion, incremental observeDepends on your orchestration
Browser supportChromium, Firefox, WebKitChromium only
Session managementBuilt-in persistence, dormant sessionsManual
Error recoveryRecovery hints, self-healing selectorsRaw protocol errors

When to Use CDP

Use CDP when you need

  • Direct access to CDP domains (Performance, Profiler, Memory, Network conditions) - Custom debugging and profiling instrumentation - Low-level network interception with full headers - Service Worker and Cache API inspection - Chrome-specific features not exposed by Playwright

Use BAP when you need

  • AI agent browser automation - Semantic element targeting that survives redesigns - Multi-step workflows with error recovery - Structured data extraction without writing JS - Cross-browser support (Chromium + Firefox + WebKit) - Token-efficient agent communication

BAP + CDP Together

BAP supports connecting to a browser via CDP for hybrid workflows:
// Launch Chrome with remote debugging
// Then connect BAP to it
await client.launch({
  cdpUrl: "ws://localhost:9222",
});

// Use BAP's high-level API
await client.navigate("https://example.com");
const obs = await client.observe();

// BAP handles the CDP complexity underneath
You can also use Chrome DevTools alongside BAP for debugging:
  1. Launch Chrome with --remote-debugging-port=9222
  2. Open chrome://inspect for live DevTools access
  3. Connect BAP with --connect=ws://localhost:9222
  4. Debug with DevTools while BAP automates
See the CDP Attach guide for detailed setup instructions.

CDP Complexity BAP Handles For You

What you would need to implement yourself with raw CDP:
CapabilityCDP ImplementationBAP Equivalent
Click a button by labelDOM.querySelector + Runtime.evaluate to find by text + Input.dispatchMouseEventclient.click(label("Submit"))
Fill a formMultiple DOM.focus + Input.insertText calls per fieldclient.act([step("action/fill", ...), ...])
Get interactive elementsAccessibility.getFullAXTree + manual filtering + ref trackingclient.observe()
Extract structured dataRuntime.evaluate with custom extraction JSclient.extract({ schema })
Handle navigationPage.navigate + Page.loadEventFired + error handlingclient.navigate(url)
Cross-browserNot possible (CDP is Chrome-only)Built-in via Playwright