Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cua_sandbox-0.1.10.tar.gz (141.9 kB view details)

Uploaded Source

Built Distribution

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

cua_sandbox-0.1.10-py3-none-any.whl (172.8 kB view details)

Uploaded Python 3

File details

Details for the file cua_sandbox-0.1.10.tar.gz.

File metadata

  • Download URL: cua_sandbox-0.1.10.tar.gz
  • Upload date:
  • Size: 141.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for cua_sandbox-0.1.10.tar.gz
Algorithm Hash digest
SHA256 464693f1e8544e206da50e93cb044befc7f07b75f0855da39793c9d82477417a
MD5 af839cc4e739fda88015cce4a2c025bf
BLAKE2b-256 0368b95cc5bd8df5aa0f776d24d218464a28e57776e1a75fc3ce2325e876f34b

See more details on using hashes here.

File details

Details for the file cua_sandbox-0.1.10-py3-none-any.whl.

File metadata

  • Download URL: cua_sandbox-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 172.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for cua_sandbox-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 b5b15dc10a33fa0ca825798d2401a0f7081f937e688eec528c4395e2f9212dbc
MD5 a917edbffd188445e78c0d48e47e3f6d
BLAKE2b-256 d2d6f95ee9895cd7d0dd84077d1250aca7b3f726734092893c33dcca8795da05

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