Universal Sandbox Python SDK
Python SDK for Universal Sandbox API.
Installation
pip install universal-sandbox
Usage
For more detailed usage, please refer to example.py
from universal_sandbox import Sandbox
# Initialize client
# Get Sandbox API Token from https://ai-infra.org/
sandbox = Sandbox(token="sandbox-api-token")
# Check API health
health = sandbox.check_health()
print(health.status)
# Create a code interpreter sandbox
sb = sandbox.code_interpreter.create()
print(f"Sandbox ID: {sb.id}")
print(f"Provider: {sb.provider}")
# Execute code
result = sandbox.sandboxes.execute(sb.id, command="print('Hello, World!')")
print(result.stdout)
# Get sandbox info
info = sandbox.sandboxes.get(sb.id)
print(f"Status: {info.status}")
# List all sandboxes
sandbox_list = sandbox.sandboxes.list()
print(f"Total: {sandbox_list.total}")
# Delete sandbox
sandbox.sandboxes.delete(sb.id)
API to SDK Mapping
| API Endpoint | SDK Interface |
|---|---|
GET /health |
sandbox.check_health() |
GET /regions |
sandbox.list_regions() |
GET /limits |
sandbox.get_limits() |
POST /sandboxes/code-interpreter |
sandbox.code_interpreter.create() |
POST /sandboxes/browser |
sandbox.browser.create() |
POST /sandboxes/aio |
sandbox.aio.create() |
GET /sandboxes |
sandbox.sandboxes.list() |
GET /sandboxes/{id} |
sandbox.sandboxes.get() |
DELETE /sandboxes/{id} |
sandbox.sandboxes.delete() |
POST /sandboxes/{id}/execute |
sandbox.sandboxes.execute() |
POST /admin/tokens |
sandbox.tokens.issue() |
POST /admin/tokens/{prefix}/revoke |
sandbox.tokens.revoke() |
GET /admin/users/{user_id}/token |
sandbox.tokens.get() |
API Reference
Sandbox Client
from universal_sandbox import Sandbox
sandbox = Sandbox(
token="your-token", # API token (optional if auth disabled)
base_url="https://...", # Optional, defaults to production
)
Root Methods
sandbox.check_health()- Check API health statussandbox.list_regions()- List available regions for all providerssandbox.get_limits()- Get resource limits and current usage
Sandbox Creation
sandbox.code_interpreter.create(provider, timeout_minutes, region, metadata)- Create code interpretersandbox.browser.create(provider, timeout_minutes, region, metadata)- Create browser sandboxsandbox.aio.create(provider, timeout_minutes, region, metadata)- Create all-in-one sandbox (only supportsprovider="volcengine")
Sandbox Management
sandbox.sandboxes.list()- List all sandboxessandbox.sandboxes.get(sandbox_id)- Get sandbox by IDsandbox.sandboxes.delete(sandbox_id)- Delete a sandboxsandbox.sandboxes.execute(sandbox_id, command, timeout)- Execute command
Token Management (Admin)
sandbox.tokens.issue(...)- Create a personal access tokensandbox.tokens.revoke(prefix)- Revoke a tokensandbox.tokens.get(user_id)- Get user's token
Metadata
Release files for universal-sandbox 0.0.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| universal_sandbox-0.0.12.tar.gz | 30.6 kB | Without provenance | Details for universal_sandbox-0.0.12.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| universal_sandbox-0.0.12-py3-none-any.whl | Python 3 | none | any | Details for universal_sandbox-0.0.12-py3-none-any.whl |
Total release size: 85.9 kB
Release files / universal_sandbox-0.0.12.tar.gz
| Download URL | universal_sandbox-0.0.12.tar.gz |
|---|---|
| Size | 30.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ef6c72acf81ea882a7e50e2d7633e1f6cdc7eb17f6118613c97f72e3fd3a1714
|
|
BLAKE2b-256 checksum How to use checksums |
12f40148a0e92c042059fb4c4d5593ad8c1069d9af5a26ce2fe93367bfe33b4b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / universal_sandbox-0.0.12-py3-none-any.whl
| Download URL | universal_sandbox-0.0.12-py3-none-any.whl |
|---|---|
| Size | 55.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa924e541d1adc6d4c52530cdac5fa7afdab53e73cd3792f7897c43fc47ce223
|
|
BLAKE2b-256 checksum How to use checksums |
fe64fef9c192a6e9ab226e8337df48f59f3fd1844f3b5e60e95e0c9779958ed2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Security for universal-sandbox 0.0.12
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.