CUA Sandbox — ephemeral and persistent sandboxed computer environments
Project description
cua-sandbox
Sandboxed VM environments with a unified Python API. Cloud by default.
pip install cua-sandbox
Ephemeral sandbox
Created on enter, destroyed on exit.
from cua_sandbox import Sandbox, Image
async with Sandbox.ephemeral(Image.linux()) as sb:
await sb.shell.run("uname -a")
await sb.screenshot()
Persistent sandbox
Provision a new sandbox that stays alive after your script exits.
from cua_sandbox import Sandbox, Image
sb = await Sandbox.create(Image.linux())
await sb.shell.run("uname -a")
print(sb.name) # save this to reconnect later
await sb.disconnect()
Connect to existing sandbox
Attach to a sandbox that's already running. Works as a plain await or context manager.
from cua_sandbox import Sandbox
# plain await
sb = await Sandbox.connect("my-sandbox")
await sb.shell.run("whoami")
await sb.disconnect()
# context manager — disconnects on exit, sandbox keeps running
async with Sandbox.connect("my-sandbox") as sb:
await sb.shell.run("whoami")
Destroy a sandbox
await sb.destroy() # disconnect + permanently delete
Local VM
Spins up a local VM using QEMU or Lume, destroyed on exit.
from cua_sandbox import Sandbox, Image
from cua_sandbox.runtime import QEMURuntime
async with Sandbox.ephemeral(Image.linux(), local=True, runtime=QEMURuntime()) as sb:
await sb.shell.run("uname -a")
Localhost (unsandboxed)
Direct host control — not sandboxed, use with caution.
from cua_sandbox import Localhost
async with Localhost.connect() as host:
await host.shell.run("echo hello")
await host.screenshot()
Project details
Release history Release notifications | RSS feed
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 cua_sandbox-0.1.2.tar.gz.
File metadata
- Download URL: cua_sandbox-0.1.2.tar.gz
- Upload date:
- Size: 120.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d80bd103adc76ef6e3ed0e81c4f91fe08f7ac9e9e2935a93cd7235e48a902b7a
|
|
| MD5 |
b89f9a4c8b6ff5eac0871a638068f3e2
|
|
| BLAKE2b-256 |
aefd41df3ae79b6e16812c2b58b8c9b28e269dd860046142314c460266b14243
|
File details
Details for the file cua_sandbox-0.1.2-py3-none-any.whl.
File metadata
- Download URL: cua_sandbox-0.1.2-py3-none-any.whl
- Upload date:
- Size: 149.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a9723c55ac2e0e1181ad6f0604e5793c472c30b3d3c5a1873dbebec0b4c3795
|
|
| MD5 |
b53b5d016daf795dfd3567329c1ed70c
|
|
| BLAKE2b-256 |
4aa0f0603f470de7a888f897cc2e107c84bc061ce0a8b71da32de7f294ff09f8
|