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.5.tar.gz (136.0 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.5-py3-none-any.whl (165.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cua_sandbox-0.1.5.tar.gz
  • Upload date:
  • Size: 136.0 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.5.tar.gz
Algorithm Hash digest
SHA256 48b13e788c11949865f29379a04098372d285ed81f8ccde641f68c92609e2001
MD5 c1bb1562287489b78ca5a181bc6a1292
BLAKE2b-256 b2d9e3ee9e56b259ac2afaab88352805c6444aa8ce87cd66c7beb985574d5da2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cua_sandbox-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 165.7 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b3c93354778f0f40ae055b6ded3fbf1ad5bcd72deb905bf0d7e652a2b4587911
MD5 36e0ffc4d48e9a993b0a2a7d9b575bef
BLAKE2b-256 1e8e1be9d13f5363411c8f7bd87c75351c6d0fb8b600f8dc01e3d7d08619f524

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