Skip to main content

BCTRL Python SDK

Sync and async clients for all current BCTRL public API operations: Browsers, Sandboxes, Tasks, Agents, Spaces, Files, Secrets, Tools, Runs, and account resources. Requires Python 3.10 or newer; supports Pydantic 1 and 2.

pip install bctrl
import os
from bctrl import Bctrl, AsyncBctrl

client = Bctrl(token=os.environ['BCTRL_API_KEY'])
spaces = client.spaces.list(limit=20)
print(spaces.data)

Create a recording-enabled browser and stop its Run:

import uuid

browser = client.browsers.create(
    name='example-browser', recording=True, wait=60,
    idempotency_key=str(uuid.uuid4()),
)
print(browser.id, browser.current_run)
client.browsers.stop(browser.id, wait=60)

While a browser has an active Run, upload a file into it:

with open('input.txt', 'rb') as source:
    client.browsers.files.upload(
        'example-browser', path='/workspace/input.txt', file=source,
    )

AsyncBctrl exposes the same operations with awaitable methods. Models use snake_case at the Python boundary and preserve the API's wire aliases. Pagination, binary responses, SSE streaming, and multipart uploads are generated from the same public contract. bctrl.api remains an alias for the current client.

Requests pin BCTRL-Version: 2026-10-03. Use bctrl_space and bctrl_subaccount_id for authorized scope selectors. Custom base_url values identify the API origin, without a trailing /v1.

Read operations retry transient responses. Writes automatically retry only when an explicit idempotency key is supplied; multipart uploads, conflicts, and unknown outcomes are not replayed. Authenticated redirects are refused, including with a custom httpx client. Catch BctrlError to inspect HTTP status and error body; unexpected response shapes retain that HTTP context.

Migrating to 0.3

The default Bctrl import now uses the current generated client and accepts token instead of api_key. Migrate Runtime/Toolset/Conversation-message workflows to Browsers/Sandboxes and Agents/Tasks. Method signatures and the generated API reference show the request parameters for each operation.

Historical helpers remain under bctrl.legacy for callers targeting an older API. Their retired routes are not supported by the current production API.

Metadata

Release files for bctrl 0.3.0

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

Source distribution (sdist)

Source distribution for bctrl 0.3.0
File Size Uploaded Provenance
bctrl-0.3.0.tar.gz 402.2 kB With provenance Details

Built distribution (wheel)

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

Total release size: 1.4 MB

Release files / bctrl-0.3.0.tar.gz

Download URL bctrl-0.3.0.tar.gz
Size 402.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0280551cf24ca247e28b73b66d5ff3512a5a6f215698a00780a2027b0bd0493f
BLAKE2b-256 checksum
How to use checksums
df3da251d1aad3de89c6d0254e78ee6efd09405c697f39dad17c1edb8e035081
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 12, 2026.

Transparency log

Release files / bctrl-0.3.0-py3-none-any.whl

Download URL bctrl-0.3.0-py3-none-any.whl
Size 1.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
2891ae4b22a6e8633f5f62efed17a496c69f33a9882f466fdfb479f903bf41fe
BLAKE2b-256 checksum
How to use checksums
8557f5f680ef8aa20c017e3a6d84b9336ff6fac778fa39d58755db09fe314ede
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 12, 2026.

Transparency log

Security for bctrl 0.3.0

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for bctrl-0.3.0.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 Oct 12, 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.

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