Quickly sandbox your AI agent.
Python
Switch CI to GitHub-hosted runners with environment protection
Tyler Payne17fada1d2972
diff --git a/.github/workflows/check.yml b/.github/workflows/check.ymlindex 5e74ef2..4e71f76 100644--- a/.github/workflows/check.yml+++ b/.github/workflows/check.yml@@ -9,7 +9,7 @@ on:jobs:checks:- runs-on: [self-hosted, linux, x64]+ runs-on: ubuntu-lateststrategy:fail-fast: falsematrix:diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex dbf6c9e..c48dbfd 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -15,7 +15,8 @@ jobs:# Validate# --------------------------------------------------------------------------uvr-validate:- runs-on: [self-hosted, linux, x64]+ runs-on: ubuntu-latest+ environment: releasesteps:- uses: actions/checkout@v6- id: setup-uv@@ -38,7 +39,8 @@ jobs:# --------------------------------------------------------------------------check:needs: [uvr-validate]- runs-on: [self-hosted, linux, x64]+ runs-on: ubuntu-latest+ environment: releasestrategy:fail-fast: truematrix:@@ -92,7 +94,8 @@ jobs:verify-licenses:needs: [uvr-validate, uvr-build]if: always() && !failure() && !cancelled() && !contains(fromJSON(inputs.plan).skip, 'verify-licenses')- runs-on: [self-hosted, linux, x64]+ runs-on: ubuntu-latest+ environment: releasesteps:- uses: actions/checkout@v6- uses: astral-sh/setup-uv@v7@@ -109,7 +112,8 @@ jobs:test:needs: [uvr-build, verify-licenses]if: always() && !failure() && !cancelled() && !contains(fromJSON(inputs.plan).skip, 'test')- runs-on: [self-hosted, linux, x64]+ runs-on: ubuntu-latest+ environment: releasetimeout-minutes: 15strategy:fail-fast: true@@ -152,7 +156,8 @@ jobs:# --------------------------------------------------------------------------uvr-release:needs: [uvr-build, verify-licenses, test]- runs-on: [self-hosted, linux, x64]+ runs-on: ubuntu-latest+ environment: releaseif: ${{ always() && !failure() && !cancelled() && !contains(fromJSON(inputs.plan).skip, 'uvr-release') }}steps:- id: checkout@@ -182,7 +187,8 @@ jobs:publish:needs: [uvr-validate, check, uvr-build, verify-licenses, uvr-release]if: ${{ always() && !failure() && !cancelled() && !contains(fromJSON(inputs.plan).skip, 'publish') }}- runs-on: [self-hosted, linux, x64]+ runs-on: ubuntu-latest+ environment: releasesteps:- uses: actions/checkout@v6with:@@ -206,7 +212,8 @@ jobs:# Bump — post-release version bump# --------------------------------------------------------------------------uvr-bump:- runs-on: [self-hosted, linux, x64]+ runs-on: ubuntu-latest+ environment: releaseif: ${{ always() && !failure() && !cancelled() && !contains(fromJSON(inputs.plan).skip, 'uvr-bump') }}needs:- uvr-releasediff --git a/pyproject.toml b/pyproject.tomlindex e7afae7..53a5e01 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -27,19 +27,19 @@ workflow_version = "0.28.1"skill_version = "0.27.1a3"[tool.uvr.matrix]-aif-agent-sandbox = [["self-hosted", "linux", "x64"], ["self-hosted", "macos", "arm64"]]-aif-cua-agent-sandbox = [["self-hosted", "linux", "x64"], ["self-hosted", "macos", "arm64"]]-quicksand = [["self-hosted", "linux", "x64"]]-quicksand-alpine = [["self-hosted", "linux", "x64"], ["self-hosted", "macos", "arm64"]]-quicksand-alpine-desktop = [["self-hosted", "linux", "x64"], ["self-hosted", "macos", "arm64"]]-quicksand-base-scaffold = [["self-hosted", "linux", "x64"]]-quicksand-core = [["self-hosted", "linux", "x64"]]-quicksand-image-tools = [["self-hosted", "linux", "x64"]]-quicksand-overlay-scaffold = [["self-hosted", "linux", "x64"]]-quicksand-qemu = [["self-hosted", "windows", "x64"], ["self-hosted", "windows", "arm64"], ["self-hosted", "linux", "x64"], ["self-hosted", "linux", "arm64"], ["self-hosted", "macos", "arm64"]]-quicksand-smb = [["self-hosted", "linux", "x64"]]-quicksand-ubuntu = [["self-hosted", "linux", "x64"], ["self-hosted", "macos", "arm64"]]-quicksand-ubuntu-desktop = [["self-hosted", "linux", "x64"], ["self-hosted", "macos", "arm64"]]+aif-agent-sandbox = [["ubuntu-latest"], ["macos-latest"]]+aif-cua-agent-sandbox = [["ubuntu-latest"], ["macos-latest"]]+quicksand = [["ubuntu-latest"]]+quicksand-alpine = [["ubuntu-latest"], ["macos-latest"]]+quicksand-alpine-desktop = [["ubuntu-latest"], ["macos-latest"]]+quicksand-base-scaffold = [["ubuntu-latest"]]+quicksand-core = [["ubuntu-latest"]]+quicksand-image-tools = [["ubuntu-latest"]]+quicksand-overlay-scaffold = [["ubuntu-latest"]]+quicksand-qemu = [["windows-latest"], ["ubuntu-latest"], ["macos-latest"]]+quicksand-smb = [["ubuntu-latest"]]+quicksand-ubuntu = [["ubuntu-latest"], ["macos-latest"]]+quicksand-ubuntu-desktop = [["ubuntu-latest"], ["macos-latest"]][tool.uv.sources]quicksand = { workspace = true }diff --git a/test_aif_agent_sandboxes.py b/test_aif_agent_sandboxes.pydeleted file mode 100644index 2fe7a6d..0000000--- a/test_aif_agent_sandboxes.py+++ /dev/null@@ -1,77 +0,0 @@-"""Load the saved AIF agent sandboxes and verify everything works via bare commands."""--import asyncio-import sys-from pathlib import Path--from quicksand import UbuntuSandbox--SAVE_DIR = Path(__file__).parent---async def run(sb, cmd, timeout=30.0):- print(f">>> {cmd}")- result = await sb.execute(cmd, timeout=timeout, shell="/bin/bash")- print(result.stdout, end="")- if result.stderr:- print(result.stderr, end="", file=sys.stderr)- if result.exit_code != 0:- raise RuntimeError(f"FAIL (exit {result.exit_code}): {cmd}")- return result---async def test_agent_harness():- print("=" * 60)- print("Testing aif-agent-harness")- print("=" * 60)-- sb = UbuntuSandbox(image=str(SAVE_DIR / "aif-agent-harness.tar.gz"))- async with sb:- # Bare python/pip on PATH (no /opt/python/bin prefix)- await run(sb, "python3 --version")- await run(sb, "python --version")- await run(sb, "pip --version")- await run(sb, "pip3 --version")-- # Packages importable- await run(sb, "python -c 'import requests; print(f\"requests {requests.__version__}\")'")- await run(sb, "python -c 'import markitdown; print(\"markitdown OK\")'")-- print("\naif-agent-harness: PASSED\n")---async def test_cua_agent_harness():- print("=" * 60)- print("Testing aif-cua-agent-harness")- print("=" * 60)-- sb = UbuntuSandbox(image=str(SAVE_DIR / "aif-cua-agent-harness.tar.gz"))- async with sb:- # Everything from layer 1 still works- await run(sb, "python --version")- await run(sb, "pip --version")- await run(sb, "python -c 'import requests; import markitdown; print(\"layer 1 OK\")'")-- # Playwright importable and chromium installed- await run(- sb,- "python -c 'from playwright.sync_api import sync_playwright; print(\"playwright OK\")'",- )- await run(sb, "playwright --version")-- # VNC stack present- await run(sb, "which Xvfb")- await run(sb, "which x11vnc")- await run(sb, "which openbox")-- print("\naif-cua-agent-harness: PASSED\n")---async def main():- await test_agent_harness()- await test_cua_agent_harness()- print("All tests passed.")---if __name__ == "__main__":- asyncio.run(main())diff --git a/test_cua_sandbox.py b/test_cua_sandbox.pydeleted file mode 100644index 97296fe..0000000--- a/test_cua_sandbox.py+++ /dev/null@@ -1,37 +0,0 @@-"""Load aif-cua-agent-sandbox-slim and verify chromium-vnc service starts."""--import asyncio-import random-import time--from quicksand import PortForward, Sandbox-from quicksand_core._types import NetworkMode--HOST_PORT = random.randint(20000, 50000)---async def main():- sb = Sandbox(- image="aif-cua-agent-sandbox-slim.tar.gz",- port_forwards=[PortForward(host=HOST_PORT, guest=5901)],- network_mode=NetworkMode.FULL,- )- async with sb:- time.sleep(5)-- r = await sb.execute("rc-status", shell="/bin/sh")- print(r.stdout)-- r = await sb.execute("ss -tlnp | grep 5901", shell="/bin/sh")- print(f"VNC listening: {r.stdout.strip()}")-- print(f"\nConnect VNC viewer to localhost:{HOST_PORT}")- print("Ctrl+C to stop")- try:- while True:- time.sleep(1)- except KeyboardInterrupt:- pass---asyncio.run(main())diff --git a/uvr_hooks.py b/uvr_hooks.pyindex 0eb70f1..8873750 100644--- a/uvr_hooks.py+++ b/uvr_hooks.py@@ -14,8 +14,8 @@ from uv_release_monorepo.shared.models import BuildStage, ReleasePlan# x64 images are built natively on Linux; arm64 images are built on# macOS because the Linux arm64 runners lack KVM for overlay builds.RETAG_RUNNERS: list[list[str]] = [- ["self-hosted", "linux", "x64"],- ["self-hosted", "macos", "arm64"],+ ["ubuntu-latest"],+ ["macos-latest"],]_WHEEL_RE = re.compile(