Universal sandbox orchestrator for AI agents — Python SDK
Project description
roche-sandbox
Python SDK for Roche -- universal sandbox orchestrator for AI agents.
Requirements
- Python >= 3.10
- Roche CLI on
PATH(or Roche daemon running)
Install
pip install roche-sandbox
Quick Start
from roche_sandbox import Roche
roche = Roche()
sandbox = roche.create(image="python:3.12-slim")
output = sandbox.exec(["python3", "-c", "print('Hello from Roche!')"])
print(output.stdout) # Hello from Roche!
sandbox.destroy()
Context Manager (auto-cleanup)
with roche.create(image="python:3.12-slim") as sandbox:
output = sandbox.exec(["echo", "hello"])
Async API
import asyncio
from roche_sandbox import AsyncRoche
async def main():
roche = AsyncRoche()
sandbox = await roche.create(image="python:3.12-slim")
output = await sandbox.exec(["echo", "hello"])
await sandbox.destroy()
asyncio.run(main())
Configuration
sandbox = roche.create(
image="python:3.12-slim",
memory="512m",
cpus=1.0,
timeout_secs=600,
network=False, # default: AI-safe
writable=False, # default: AI-safe
env={"API_KEY": "secret"},
)
Transport
The SDK auto-detects whether the Roche gRPC daemon is running and connects to it. If the daemon is unavailable, it falls back to invoking the Roche CLI as a subprocess.
You can force CLI mode explicitly:
roche = Roche(mode="direct")
API Styles
The SDK provides two API styles:
- Async-first:
AsyncRocheandAsyncSandbox-- nativeasync/awaitsupport. - Sync wrapper:
RocheandSandbox-- blocking equivalents for scripts and notebooks.
Public Exports
from roche_sandbox import (
Roche, AsyncRoche,
Sandbox, AsyncSandbox,
SandboxConfig, ExecOutput, SandboxInfo,
Mount, SandboxStatus,
RocheError, SandboxNotFound, SandboxPaused,
ProviderUnavailable, TimeoutError, UnsupportedOperation,
)
License
Apache-2.0 -- see LICENSE.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file roche_sandbox-0.1.0.tar.gz.
File metadata
- Download URL: roche_sandbox-0.1.0.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85d7d7cfd19c4a3a182568c6babecd41334ba352b999d77a4075270406641630
|
|
| MD5 |
a55f69ade4056f7931fe5d7ff151d6b4
|
|
| BLAKE2b-256 |
7cb294b1f20aa56c594210b70dba8c1a3272676d2014ae30235030d331f31545
|
File details
Details for the file roche_sandbox-0.1.0-py3-none-any.whl.
File metadata
- Download URL: roche_sandbox-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c20794b53b82d6c412b0ae71e77743da85229454c8c1618f21c1ccfea2ac514
|
|
| MD5 |
3e64a78bf91fd4d73e6a76714fe77626
|
|
| BLAKE2b-256 |
1e3c6a75fd77a41db65b1a92e148936c62b8ebb65467f322468c9d8857745a91
|