Skip to main content

Sandbox0 Python SDK

Project description

Sandbox0 Python SDK

The official Python SDK for Sandbox0, providing typed models and ergonomic high-level APIs for managing secure code execution sandboxes.

Installation

pip install sandbox0

Requirements

  • Python 3.9 or later

Configuration

Environment Variable Required Default Description
SANDBOX0_TOKEN Yes - API authentication token
SANDBOX0_BASE_URL No https://api.sandbox0.ai API base URL

Quick Start

import os
from sandbox0 import Client

client = Client(token=os.environ["SANDBOX0_TOKEN"])

# Using context manager for automatic cleanup
with client.sandboxes.open("default") as sandbox:
    # Execute Python code (REPL - stateful)
    result = sandbox.run("python", "print('Hello, Sandbox0!')")
    print(result.output_raw, end="")

Examples

Runnable examples are available in the examples/ directory:

Example Description
01_hello_world Basic sandbox usage
02_context_options Context configuration options
03_files File read/write/list operations
04_streaming Streaming execution output
05_templates Working with sandbox templates
06_volumes Persistent volumes and snapshots
07_webhook Webhook event delivery
08_network Network policy configuration
09_expose_port Exposing ports publicly

Run an example:

cd examples/01_hello_world
SANDBOX0_TOKEN=your-token python main.py

Links

License

Apache-2.0

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

sandbox0-0.2.0.tar.gz (128.9 kB view details)

Uploaded Source

Built Distribution

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

sandbox0-0.2.0-py3-none-any.whl (432.9 kB view details)

Uploaded Python 3

File details

Details for the file sandbox0-0.2.0.tar.gz.

File metadata

  • Download URL: sandbox0-0.2.0.tar.gz
  • Upload date:
  • Size: 128.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for sandbox0-0.2.0.tar.gz
Algorithm Hash digest
SHA256 44a85d4d88763672d2f1ca6e9f93aeaa95c293e3d0f9d3805107680621e8a79b
MD5 08d40926b917c3307a011fc7fe056b74
BLAKE2b-256 d2e6bd7908ce528b8709a2c3f6cee61664718978546b15506e8297ee7362e9f2

See more details on using hashes here.

File details

Details for the file sandbox0-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: sandbox0-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 432.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for sandbox0-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 88a72c970a168c6e6c2b57bb6bdf0d6ecb0fbc4c1c1a8733e1be4b1dd6ae517a
MD5 4cdf510f5f778b0201bf09f49958f5b7
BLAKE2b-256 b7dedd7b5622fe3d86412125aa90d3e89afb642b8b2cf08bb5230d7dcfd4b7f0

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