This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is the Hyperbrowser Python SDK - a client library for interacting with the Hyperbrowser API for cloud browser automation. It provides both synchronous (Hyperbrowser) and asynchronous (AsyncHyperbrowser) clients.
Use Python 3.12 for the Poetry development environment. CI exercises runtime compatibility from Python 3.8 through 3.14.
# Install dependencies (uses Poetry)
poetry install
# Run linting with ruff
poetry run ruff check .
# Format code with ruff
poetry run ruff format .
# Run the non-E2E test suite
poetry run pytest tests --ignore=tests/sandbox/e2eThe SDK follows a dual sync/async pattern with mirrored implementations:
- Entry Points:
Hyperbrowser(sync) andAsyncHyperbrowser(async) inhyperbrowser/__init__.py - Base Class:
HyperbrowserBaseinclient/base.pyhandles common config and URL building - Transport Layer:
transport/containsSyncTransportandAsyncTransportwrapping httpx clients
Both clients expose identical APIs through manager classes that handle specific resource types:
client.sessions # Browser session management
client.scrape # Web scraping jobs
client.scrape.batch # Batch web scraping jobs
client.crawl # Website crawling jobs
client.extract # Data extraction jobs
client.web # Web fetch/search operations
client.web.batch_fetch # Batch web fetch operations
client.agents # AI agent integrations (browser_use, cua, claude_computer_use, hyper_agent, gemini_computer_use)
client.profiles # Browser profile management
client.extensions # Browser extension management
client.team # Team/credit info
client.computer_action # Low-level computer actions
Each manager lives in client/managers/sync_manager/ or client/managers/async_manager/ with identical method signatures.
TypedDict request types are in hyperbrowser/types/. Pydantic response models
and backwards-compatible request classes remain in hyperbrowser/models/.
Managers accept either request dictionaries or the legacy request model and
normalize both through the shared request serializer.
Response and legacy models are re-exported from
hyperbrowser/models/__init__.py; request TypedDicts are re-exported from
hyperbrowser/types/__init__.py.
hyperbrowser/tools/ contains ready-to-use tool definitions for OpenAI and Anthropic function calling:
WebsiteScrapeTool,WebsiteScreenshotTool,WebsiteCrawlTool,WebsiteExtractTool,BrowserUseTool- Each has
openai_tool_definition,anthropic_tool_definition, plus sync/async runnable methods
- API Key: Via constructor
api_key=orHYPERBROWSER_API_KEYenv var - Base URL: Defaults to
https://api.hyperbrowser.ai, configurable viabase_url=orHYPERBROWSER_BASE_URL - Job Polling: Managers provide
start_and_wait()methods that poll until completion - Context Managers:
AsyncHyperbrowsersupportsasync withfor automatic cleanup