Skip to main content
The Python SDK mirrors the TypeScript client API with Pythonic conventions. It supports both async and sync usage, making it ideal for notebooks, scripts, and Python-based AI agents.

Installation

Sync API (Scripts and Notebooks)

High-Level Session Helper

The bap_session context manager handles browser launch, page creation, and cleanup:

Semantic Selectors

AI Agent Methods

Multi-Context Support

Create isolated browser contexts with separate cookies and storage:

Frame Support

Error Handling

Starting the Server

The Python SDK requires a running BAP server:
The Python SDK connects to a BAP server over WebSocket. The server itself is a Node.js process — install it via npm.

Requirements

  • Python >= 3.10
  • A running BAP Playwright server