Skip to content

v0.1.8

Choose a tag to compare

@cr-sbarbouche cr-sbarbouche released this 19 Nov 17:52
6f313ea
  • GitHub Action: uses: cr-sbarbouche/agvisor@v0.1.8 runs a script in a gVisor sandbox on the runner, with image, run, workspace (the job's files, copied to /workspace), output (a directory copied back to ./agvisor-out, even if the script failed), egress, inject, cpus, memory, timeout and host. It installs the pinned runsc when the runner has none, and fails the step with the script's exit code. inject: is HOST:HEADER=ENVVAR: the value is the calling step's $ENVVAR, so a secret is never on a command line and the script can use it without holding it. host: ssh://user@vm runs the sandbox on another machine's docker; a self-hosted runner with runsc set up works too (README, "On your own machine instead of GitHub's")
  • agvisor run IMAGE [options] -- COMMAND: what the Action calls. Makes a sandbox, runs the command, removes the sandbox, exits with the command's code. --cpus, --memory, --pids, --timeout, --egress, --inject, --put, --get, --host. The sandbox expires on its own --timeout plus 5 minutes after it started, so a killed job doesn't leave it running
  • create_sandbox(ports=[8000]) publishes those container ports on the docker host's 127.0.0.1; sb.port(8000) returns the host port. AGVISOR_PORTS and an MCP port tool (only when set) do the same for the MCP server. Refused with gui, network="none", egress= and inject=; AsyncSandbox.port is included
  • Sandbox.stats() returns CPU, memory, the memory limit and the process count from docker stats, with an MCP stats tool and AsyncSandbox.stats. Under gVisor, memory counts /tmp but not root-filesystem writes, and the process count is host threads (an idle sandbox reads about 35); a call takes about 1 s
  • The egress proxy closes a tunnel that has been quiet in both directions for 15 minutes. A download the client says nothing during is not quiet
  • examples/09_browser_egress.py: Chromium ignores HTTPS_PROXY, so the example passes the proxy to chromium.launch(proxy=...); a host that isn't allowed fails with net::ERR_TUNNEL_CONNECTION_FAILED
  • Tested on real gVisor (runsc 20261026.0, GitHub's Ubuntu runner): tests/test_gvisor_ports.py, tests/test_gvisor_stats.py, the examples including 09, and the Action itself (uses: ./: files in and out, an allowed and a refused host, an injected key reaching api.anthropic.com and absent from the sandbox's environment). The idle timeout has only a unit test with a 0.3 s timeout. Not tested: a self-hosted runner, host: ssh://... against a real VM, ports= over host="ssh://...", inject= used by git or curl (Python's urllib only)