Skip to main content

Python SDK for BrowserBase Stagehand

Project description

Stagehand Python SDK

A Python SDK for BrowserBase Stagehand, enabling automated browser control and data extraction.

Installation

pip install stagehand-py

Usage

import asyncio
from stagehand import Stagehand

async def main():
    # Initialize the Stagehand client
    browser = Stagehand(
        env="BROWSERBASE",
        api_key="your-api-key",
        project_id="your-project-id"
    )
    
    # Perform browser actions
    result = await browser.act("Navigate to google.com")
    
    # Extract data using a schema
    data = await browser.extract("Get the search results", {
        "results": [{"title": "string", "url": "string"}]
    })
    
    # Close the browser
    await browser.close()

# Run the example
asyncio.run(main())

Configuration

  • env: Environment to use (default: "BROWSERBASE")
  • api_key: Your BrowserBase API key (can also be set via BROWSERBASE_API_KEY environment variable)
  • project_id: Your BrowserBase project ID (can also be set via BROWSERBASE_PROJECT_ID environment variable)
  • verbose: Verbosity level (default: 0)

Features

  • Automated browser control with natural language commands
  • Data extraction with schema validation
  • Async/await support
  • Automatic NextJS server management

Requirements

  • Python 3.7+
  • httpx
  • asyncio

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stagehand_py-0.1.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stagehand_py-0.1.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file stagehand_py-0.1.1.tar.gz.

File metadata

  • Download URL: stagehand_py-0.1.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.9

File hashes

Hashes for stagehand_py-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2b4e368d6b4f1ba4f5d46dbd7da00656fa5b7ed938588baaff77513944f182d6
MD5 c63fa2e6e6f2f91a21377afd5c3eb2b5
BLAKE2b-256 2eab47388f4b861c224da42b071616569c131e118d61cde0a84f6df1689273bf

See more details on using hashes here.

File details

Details for the file stagehand_py-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: stagehand_py-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.9

File hashes

Hashes for stagehand_py-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 86089dc75f0f012d708989781fa5bcfacda7b80b0022813317f09c78ed093499
MD5 685ded69af11e5e8fd1cd55b2e899b3f
BLAKE2b-256 510ca548bda0ca1568bc7eb1c6fb916aa33843360a9f8ec6ad0f6d15ff081dca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page