Skip to main content

Remote browser automation for AI agents - Python SDK

Project description

bctrl

Python SDK for the BCTRL public API.

Install

pip install bctrl

Quick Start

from bctrl import Bctrl
from pydantic import BaseModel, ConfigDict


class Invoice(BaseModel):
    model_config = ConfigDict(extra="forbid")

    invoiceNumber: str
    total: float

bctrl = Bctrl(api_key="bctrl_...")

with bctrl.runtimes.started_browser(name="checkout") as browser:
    print(browser.connect_url)

    invocation = bctrl.runtimes.invocations.create_and_wait(
        browser.runtime_id,
        action="extract",
        instruction="Extract the invoice number and total.",
        output_model=Invoice,
    )

    invoice = invocation["parsed_output"]
    print(invoice.invoiceNumber, invoice.total)

    for event in bctrl.runs.events.stream(browser.run_id):
        print(event)

Python methods use snake_case; the SDK sends the API's camelCase fields on the wire. For example, runtime_path becomes runtimePath.

Design

  • Sync-first client.
  • Route-first namespaces that mirror the API reference.
  • Raw response bodies as dictionaries.
  • Pydantic model support for invocation output schemas.
  • Python context managers for runtime lifecycle cleanup.
  • Sync SSE iterators for run events and activity.
  • Explicit helpers for pagination, multipart uploads, and create_and_wait.
  • No hidden follow-up requests or stateful resource refreshes.

License

ISC

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

bctrl-0.1.1.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

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

bctrl-0.1.1-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bctrl-0.1.1.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bctrl-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1d8ec8ce1691d546c0b61453ad85099fd01b47e409e72ff253328a79b893af45
MD5 5d6e91c9beb116f5b3be4f7760aff63c
BLAKE2b-256 dddd3c0fa657f487d56ad7bb08f3703e17d2ab9bf6fec9f12f9fe125277d1ea5

See more details on using hashes here.

Provenance

The following attestation bundles were made for bctrl-0.1.1.tar.gz:

Publisher: publish.yml on bctrlhq/sdk-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: bctrl-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bctrl-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e35b130ed6080701e6462109908b0d3cc0df11e2500d1623db02169102ff2165
MD5 919091508455e18137621deea61b0862
BLAKE2b-256 6e3cba95e7124967237af55cbd2820ced0a383bc6c6473a6009c94829202f6a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for bctrl-0.1.1-py3-none-any.whl:

Publisher: publish.yml on bctrlhq/sdk-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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