Skip to main content

Meshbrow Python SDK

The official Python SDK for Meshbrow — persistent browser infrastructure for AI agents.

Launch cloud browsers that remember logins, stay undetected, and scale to hundreds of concurrent sessions. Connect via CDP (Playwright/Puppeteer) or use built-in helpers.

Installation

pip install meshbrow

Quick Start

from meshbrow import Meshbrow

client = Meshbrow(api_key="mb_your_api_key")

# Launch a cloud browser with US residential proxy
session = client.create_session(
    stealth="max",
    proxy_type="residential",
    proxy_country="US",
    viewport={"width": 1920, "height": 1080},
)

# Connect via CDP endpoint with Playwright
print(session.cdp_endpoint)  # wss://cdp.meshbrow.dev/...

# Or use built-in helpers
client.navigate(session.id, "https://example.com")
screenshot = client.screenshot(session.id)
content = client.extract(session.id, selector="h1")

# Clean up
client.destroy_session(session.id)
client.close()

Usage with Playwright

from playwright.sync_api import sync_playwright
from meshbrow import Meshbrow

client = Meshbrow(api_key="mb_your_api_key")
session = client.create_session(stealth="max")

with sync_playwright() as p:
    browser = p.chromium.connect_over_cdp(session.cdp_endpoint)
    page = browser.new_page()
    page.goto("https://example.com")
    page.screenshot(path="screenshot.png")
    browser.close()

client.destroy_session(session.id)
client.close()

Async Client

import asyncio
from meshbrow import AsyncMeshbrow

async def main():
    client = AsyncMeshbrow(api_key="mb_your_api_key")

    session = await client.create_session(
        stealth="max",
        proxy_type="residential",
        proxy_country="US",
    )

    await client.navigate(session.id, "https://example.com")
    screenshot = await client.screenshot(session.id)

    await client.destroy_session(session.id)
    await client.close()

asyncio.run(main())

Context Manager

with Meshbrow(api_key="mb_your_api_key") as client:
    session = client.create_session()
    client.navigate(session.id, "https://example.com")
    client.destroy_session(session.id)

# Async
async with AsyncMeshbrow(api_key="mb_your_api_key") as client:
    session = await client.create_session()
    await client.navigate(session.id, "https://example.com")
    await client.destroy_session(session.id)

Built-in Helpers

Navigate

client.navigate(session.id, "https://example.com", wait_until="networkidle")

Screenshot

# Full page screenshot
shot = client.screenshot(session.id, full_page=True)
# shot.data is base64-encoded PNG

# Element screenshot
shot = client.screenshot(session.id, selector="#hero")

Extract Content

content = client.extract(session.id, selector="article", max_length=10000)

Click & Type

client.click(session.id, "#login-button")
client.type_text(session.id, "#email", "user@example.com")
client.type_text(session.id, "#password", "secret", clear=True)

Execute JavaScript

result = client.execute(session.id, "return document.title")
print(result["result"])  # "Example Domain"

Fleet Operations

# Launch 10 sessions in parallel
fleet = client.create_fleet(
    count=10,
    stealth="max",
    proxy_type="residential",
    proxy_country="US",
)

print(fleet.id)       # "fleet_abc123"
print(fleet.count)    # 10

for session in fleet.sessions:
    client.navigate(session.id, "https://example.com")

# Destroy all sessions in the fleet
client.destroy_fleet(fleet.id)

Session Management

# List all active sessions
session_list = client.list_sessions()
for s in session_list.sessions:
    print(f"{s.id}: {s.status}")

# Get session details
session = client.get_session("mb_abc123")
print(session.status)       # "running"
print(session.cdp_endpoint) # "wss://..."

# Destroy with profile save
client.destroy_session(session.id, save_profile=True)

Configuration

client = Meshbrow(
    api_key="mb_your_api_key",                   # Required
    base_url="https://api.meshbrow.dev",         # Optional (default)
    timeout=30.0,                                # Request timeout in seconds (default: 30)
)

Session Options

Option Type Default Description
stealth str "max" Anti-detection level: "none", "basic", "max"
proxy_type str None "residential", "datacenter", "isp", "mobile"
proxy_country str None ISO 3166-1 alpha-2 country code
profile_id str None Persist cookies/storage across sessions
viewport dict None {"width": 1920, "height": 1080}

Error Handling

import httpx
from meshbrow import Meshbrow

client = Meshbrow(api_key="mb_your_api_key")

try:
    session = client.create_session()
except httpx.HTTPStatusError as e:
    if e.response.status_code == 401:
        print("Invalid API key")
    elif e.response.status_code == 429:
        print("Rate limited — back off")
    elif e.response.status_code == 402:
        print("Quota exceeded")
    else:
        print(f"API error: {e.response.status_code}")

Types

from meshbrow import Session, SessionList, Screenshot, Fleet

# Session
session.id            # str — "mb_abc123"
session.status        # str — "running" | "stopped" | "error"
session.cdp_endpoint  # str — "wss://cdp.meshbrow.dev/..."
session.stealth       # str — "max"
session.proxy         # dict | None
session.created_at    # str — ISO 8601
session.expires_at    # str — ISO 8601

# Screenshot
screenshot.data       # str — base64-encoded PNG
screenshot.format     # str — "png"

# Fleet
fleet.id              # str — "fleet_abc123"
fleet.status          # str
fleet.sessions        # list[Session]
fleet.count           # int

Documentation

Full docs: docs.meshbrow.dev
SDK guide: docs.meshbrow.dev/quickstart

License

MIT © Bytangle Ltd

Metadata

Release files for meshbrow 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for meshbrow 0.1.1
File Size Uploaded Provenance Actions
meshbrow-0.1.1.tar.gz 8.1 kB With provenance Details for meshbrow-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for meshbrow 0.1.1
File Interpreter ABI Platform Actions
meshbrow-0.1.1-py3-none-any.whl Python 3 none any Details for meshbrow-0.1.1-py3-none-any.whl

Total release size: 15.8 kB

Release files / meshbrow-0.1.1.tar.gz

Download URL meshbrow-0.1.1.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f5f9ce515da6cfe118ddc5a5710b0b65b0cf01632123d9f1edbd7cac141bb120
BLAKE2b-256 checksum
How to use checksums
979d4eff46d2def4ee3bb21d8dfb1375124e13b486df6829baf7cd589e97d8c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 14, 2026.

Transparency log

Release files / meshbrow-0.1.1-py3-none-any.whl

Download URL meshbrow-0.1.1-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
486ae9c244bcccfe75e371013f6475d0250b35293308f4631caba5b8452a9dad
BLAKE2b-256 checksum
How to use checksums
12db50b8ca5f125e7140b8682d7d9c73776307ceca727a1e2979afe4410ba59d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 14, 2026.

Transparency log

Security for meshbrow 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for meshbrow-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page