Skip to main content

brimble-sandbox

Python SDK for the Brimble Sandbox API.

Install

pip install brimble-sandbox

Quickstart

from brimble_sandbox import Sandbox, SandboxSize

client = Sandbox()  # reads BRIMBLE_SANDBOX_KEY from env

sandbox = client.sandboxes.create(
    {
        "template": "node-22",
        "size": SandboxSize.MICRO,
    }
)

print(sandbox.size)

result = sandbox.exec({"cmd": "node -v", "env": {"NODE_ENV": "production"}})
print(result["stdout"])

sandbox.put_files(
    [
        {"path": "/tmp/hello.txt", "body": "hello from batch"},
        {"path": "/tmp/config.json", "body": '{"mode":"dev"}'},
    ]
)

existing = client.sandboxes.get(sandbox.id)
existing.destroy()

Size

Pass a named size. Freeform specs are not accepted by the API.

Size Constant
sbx.micro SandboxSize.MICRO
sbx.small SandboxSize.SMALL
sbx.medium SandboxSize.MEDIUM

If size is omitted, the API uses the plan default. Allowed sizes are plan-gated.

Create latency

create() is a blocking POST that returns a ready sandbox. With a warm pool seed, this is typically ~0.5–1s. When the pool is empty, create fails with capacity exhausted (no silent cold boot).

Current create constraints

Warm capacity path only supports:

  • open egress
  • non-persistent (no volume / CSI attach at create)
  • no snapshot restore (fromSnapshot)
  • no one-shot

with_volume, restricted egress, and blockOutbound remain on the client; the live API rejects those create shapes today.

Ergonomic helpers

from brimble_sandbox import Sandbox, SandboxSize

client = Sandbox()

created = client.sandboxes.create(
    {"template": "node-22", "size": SandboxSize.SMALL}
)

also_ready = client.sandboxes.create_ready({"template": "node-22"})

loaded = client.sandboxes.get_ready(created.id)

created.exec({"cmd": "npm -v"}, wait_until_ready=True)

output = created.exec_stream({"cmd": "for i in 1 2 3; do echo $i; done"})
for log in output:
    if log["stream"] == "stdout":
        print(log["data"], end="")
result = output.result()

buffered = created.exec(
    {"cmd": "npm install"},
    on_stdout=lambda chunk: print(chunk, end=""),
)

file_stream = created.get_file("tmp/notes.txt")
for chunk in file_stream:
    print(chunk.decode("utf-8"), end="")
file_stream.close()

templates = client.sandboxes.list_templates()
node_template = client.sandboxes.get_template("node-22")
regions = client.sandboxes.list_regions()

for sb in client.sandboxes.iterate({"teamId": "<team>"}):
    print(sb.id, sb.status, sb.size)

Network egress

Default create uses open egress (required for warm pool).

from brimble_sandbox import Sandbox
from brimble_sandbox.enums import SandboxEgressMode

client = Sandbox()

sandbox = client.sandboxes.create({"template": "node-22"})

updated = sandbox.update_egress({"mode": SandboxEgressMode.DENY_ALL})
print(updated.get("network_updated"))

Modes: open, restricted (allowlist required), deny_all.
Restricted / deny-all at create is rejected by the warm-pool API; update after create if the product path allows it.

Auth

Requests are authenticated with the x-brimble-key header.

  • Pass api_key to Sandbox(...)
  • Or set BRIMBLE_SANDBOX_KEY in your environment

Retry, timeout, idempotency

from brimble_sandbox import RetryOptions, Sandbox

client = Sandbox(
    retry=RetryOptions(max_attempts=3, base_delay_ms=250, max_delay_ms=2000),
)

sandbox = client.sandboxes.create(
    {"template": "node-22", "size": "sbx.micro"},
    idempotency_key="create-sandbox-123",
)

If region is omitted or auto, it is omitted from the create request and the API assigns an enabled sandbox region. Pass a slug (e.g. eu-west) or region id to pin placement.

Metadata

Release files for brimble-sandbox 0.1.7

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

Source distribution (sdist)

Source distribution for brimble-sandbox 0.1.7
File Size Uploaded Provenance Actions
brimble_sandbox-0.1.7.tar.gz 21.3 kB Without provenance Details for brimble_sandbox-0.1.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for brimble-sandbox 0.1.7
File Interpreter ABI Platform Actions
brimble_sandbox-0.1.7-py3-none-any.whl Python 3 none any Details for brimble_sandbox-0.1.7-py3-none-any.whl

Total release size: 50.0 kB

Release files / brimble_sandbox-0.1.7.tar.gz

Download URL brimble_sandbox-0.1.7.tar.gz
Size 21.3 kB
Tags Source
SHA-256 checksum
How to use checksums
09274bf9a8a41b502605269817da1cc829a99a3f53c3c0b420ea9639d8ba7c4e
BLAKE2b-256 checksum
How to use checksums
da7d369c867dfaf36ee300cad145a3e9b37475e15c35d2c45cad3158bf76a40c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / brimble_sandbox-0.1.7-py3-none-any.whl

Download URL brimble_sandbox-0.1.7-py3-none-any.whl
Size 28.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b67f0a75151a16f156515fb6da31616caec3a05df2fbfc16f93f4de4e8dd5cc2
BLAKE2b-256 checksum
How to use checksums
7969a669fee0ed69f383cc7155700caf672160b3f9f25ccc38f592b23f9c8710
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for brimble-sandbox 0.1.7

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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