The new Python SDK is a pure API client. You manage the browser yourself using Playwright, Selenium, Puppeteer, or any other browser automation tool. The SDK handles only the AI-powered operations.
Overview of Changes
BYOB Architecture
You bring your own browser driver (Playwright, Selenium, etc.). The SDK is now a pure API client that handles AI-powered operations.
Session-Based API
All operations require an explicit
session_id. Start a session, perform operations, and end it when done.Multi-Browser Control
Scale browsers easily and control multiple browsers at once by passing the session ID for each browser you want to control.
Simplified Client
Cleaner initialization with dedicated parameters for API keys and configuration.
Current Limitations
Step-by-Step Migration
1. Update Imports
- Old SDK (v2)
- New SDK (v3)
2. Client Initialization
- Old SDK (v2)
- New SDK (v3)
Key differences:
- Configuration options like
dom_settle_timeout_ms,self_heal,system_prompt, andverboseare not available in the new SDK model_nameis specified when starting a session, not in the config- You must connect Playwright separately to interact with the page
3. Navigation
- Old SDK (v2)
- New SDK (v3) - Option A: Playwright
- New SDK (v3) - Option B: Stagehand API
4. Direct Page Interactions (Playwright)
Any direct page manipulation should use Playwright’s native API.- Old SDK (v2)
- New SDK (v3)
In the old SDK,
page was a Stagehand-enhanced Playwright page. In the new SDK, page is a standard Playwright page. Direct Playwright methods work the same way.5. AI-Powered Actions (act)
- Old SDK (v2)
- New SDK (v3)
Acting on an Observed Element
- Old SDK (v2)
- New SDK (v3)
6. Observing Elements (observe)
- Old SDK (v2)
- New SDK (v3)
7. Extracting Data (extract)
- Old SDK (v2)
- New SDK (v3)
8. Closing the Session
- Old SDK (v2)
- New SDK (v3)
9. Async vs Sync
- Old SDK (v2) - Async-first
- New SDK (v3) - Sync-first
- New SDK (v3) - Async
Complete Migration Example
- Before (Old SDK)
- After (New SDK)
Quick Reference: Method Mapping
Troubleshooting
Session not found errors
Session not found errors
Ensure you’re using the correct
session_id returned from client.sessions.start().Playwright connection issues
Playwright connection issues
Make sure your Browserbase API key has the correct permissions and the session is still active.
Missing x_language and x_sdk_version parameters
Missing x_language and x_sdk_version parameters
These are required for all session operations. Use
x_language="python" and x_sdk_version="3.0.6" (or the latest version).Extraction returns unexpected format
Extraction returns unexpected format
The new SDK requires an explicit JSON schema. Make sure your schema matches the expected output structure.
Need Help?
Documentation
Full Stagehand documentation
Browserbase Docs
Browserbase documentation
GitHub Issues
Report issues or get help

