Skip to content

Releases

v0.2.0

Choose a tag to compare

@cr-sbarbouche cr-sbarbouche released this 29 Nov 19:10
15cb3de
  • Network rules change while a sandbox runs: sb.allow(*entries), sb.deny(*entries), sb.egress_rules() and sb.egress_denied(). A !entry in egress= shuts a host out and wins over every allow; its port defaults to every port. allow() un-denies an entry, deny() replaces it with !entry. The proxy reloads on a signal: new connections follow the new rules at once, and tunnels already open to a host that is no longer allowed are closed. egress_denied() lists what the proxy refused as host:port, leaving out what is allowed by now (it reads the proxy's log). From a shell: agvisor allow NAME host..., agvisor deny NAME host..., agvisor egress NAME [--denied]. The MCP server gets a read-only egress_blocked tool (with AGVISOR_EGRESS or AGVISOR_INJECT); the agent has no way to change the rules. create_sandbox(egress=...) now waits until the proxy listens before it starts the sandbox
  • sb.pause() and sb.resume() (agvisor pause / resume, AsyncSandbox too) freeze every process; memory stays held, it is a freeze and not a checkpoint. exec() on a paused sandbox raises SandboxPaused. idle_ttl does not run out during a pause (the watchdog notices the freeze); lifetime keeps counting, so a sandbox paused past it is gone when resumed. stop() removes a paused sandbox, and agvisor ls shows paused
  • renewable=True with lifetime=: sb.renew(seconds) (agvisor renew NAME SECONDS) moves the deadline later or earlier. It is opt-in, because the deadline is a file inside the sandbox: code running there can extend its own life. A plain lifetime is unchanged
  • create_sandbox(mounts={"/host/path": "/inside"}) shows a host directory or file read-only, without copying it (--mount, so a missing source is an error). Refused: /, anything under /proc, /sys or /dev, sources under /run or /var/run, and *.sock. agvisor run --mount HOSTPATH:REMOTE, and AGVISOR_MOUNTS for the MCP server
  • create_sandbox(env=), exec(env=, cwd=) and spawn(env=, cwd=). Values reach docker through stdin or a file only you can read, never a command line. agvisor exec --env NAME[=VALUE] --cwd, agvisor run --env, and AGVISOR_ENV for the MCP server
  • sb.python(code, context="name"): a separate interpreter per name, with its own variables. The MCP python tool takes context too
  • MCP AGVISOR_LOG=/path/audit.jsonl: one JSON line for every tool call (arguments, sandbox, seconds, exit code, and the result or the exception), one server_start with the configuration (no secret values: the names of the AGVISOR_ENV variables and the hosts of AGVISOR_INJECT) and one sandbox_created per sandbox. Readable by its owner only, append-only, never rotated. It records the agent's tool calls, not what the code does inside
  • examples/10_agent_cli.py: Claude Code's CLI inside a sandbox behind egress= and inject=. examples/11_eval_harness.py: one sandbox per trial from a Pool, with snapshot() and restore() to retry from a clean workspace
  • The docs site has a What's new page with diagrams
  • Tested on real gVisor (runsc 20261026.0, GitHub's Ubuntu runner): tests/test_gvisor_env.py, test_gvisor_pause.py (the freeze, idle_ttl and lifetime across a pause), test_gvisor_renew.py, test_gvisor_pycontexts.py, test_gvisor_mounts.py (writes refused, host edits visible inside), test_gvisor_egress_live.py (pip refused, then allowed on the running sandbox; an open tunnel closed 0.5 s after deny()), test_mcp_stdio.py (the audit log written by a real server), and both new examples. Not tested: any of this over host="ssh://...", and example 10 with a real API key (with its placeholder key the API refuses the request, as it should)

v0.1.9

Choose a tag to compare

@cr-sbarbouche cr-sbarbouche released this 19 Nov 18:12
1844fac
  • The action is named "agvisor sandbox" so it can be listed on the GitHub Marketplace (the name agvisor belongs to another account there). uses: cr-sbarbouche/agvisor@v0.1.9 is unchanged, and the README's Action examples use this tag
  • No change to the library, the CLI or the action's inputs since 0.1.8, which introduced the GitHub Action, agvisor run, ports=, Sandbox.stats() and the egress idle timeout (see the v0.1.8 notes for what was tested and what was not)

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)

v0.1.7

Choose a tag to compare

@cr-sbarbouche cr-sbarbouche released this 16 Nov 19:23
9717f10
  • inject=: create_sandbox(inject={"api.example.com": {"Authorization": "Bearer ..."}}) gives the sandbox a credential it can use but not read. The egress proxy ends the sandbox's HTTPS to that host, sets those headers on every request (replacing one of the same name the sandbox sent) and sends it on over TLS of its own, with the host's real certificate verified. The sandbox trusts a certificate authority made for it on your machine, whose private key is dropped after it signs the one certificate the proxy needs; it is told through SSL_CERT_FILE, REQUESTS_CA_BUNDLE, CURL_CA_BUNDLE, GIT_SSL_CAINFO and NODE_EXTRA_CA_CERTS. The credential is not in the sandbox's environment, files or command lines. It is in the proxy container's environment, so whoever can run docker inspect on the host can read it. Plain host names only, https:// on port 443 only (http:// to such a host is refused), one request per connection, no HTTP/2 or websockets to those hosts. A request is only given a credential if it has a path, one Host header naming the host and no folded headers. Needs pip install 'agvisor[inject]' (the cryptography package) and the image needs a CA bundle. Same restrictions as egress=. AGVISOR_INJECT sets it for the MCP server. The README Security section has an entry for it
  • agvisor.aio: AsyncSandbox, AsyncJob, create_sandbox(), list_sandboxes() and prune_egress() for asyncio code, with the arguments, results and errors of the synchronous ones; every blocking call runs in a worker thread, so calls run side by side. async with AsyncSandbox(...) starts and stops the sandbox. Cancelling an await stops waiting, not the command. exec(on_output=) can be a plain function or an async def
  • Pool(size, image, **create_sandbox_args): keeps size started sandboxes ready, so acquire() doesn't wait for docker run, and starts a replacement in the background. A spare that expired or fails a health check is skipped. lifetime= or idle_ttl= is required, name=, owner= and gui= are refused. close() or with stops the spares
  • snapshot() pauses a running sandbox while its data dir is copied, so the snapshot is the data dir at one moment, not a mix of before and after a write. Its processes stop for those few seconds and an exec() meanwhile fails; a running sandbox that can't be paused raises instead of being copied
  • MCP server, with AGVISOR_NAME: snapshot(tag) and restore(tag) take a tag (no tag still means checkpoint), and there are two new tools, list_snapshots() and delete_snapshot(tag). AGVISOR_SNAPSHOTS (default 3) limits how many snapshots exist at once, since each one is a full copy of /workspace
  • examples/08_browser.py: a headless Chromium (Playwright's image) opens a page and takes a screenshot under gVisor, with a README section on Limits(shm=), the network and the matching Playwright version. The example is run by the gvisor CI job with the others
  • README: the two relative links are absolute (they were dead on PyPI), and the intro lists what the library has now
  • Tested on real gVisor (runsc 20261026.0, GitHub's Ubuntu runner): tests/test_gvisor_aio.py, test_gvisor_pool.py, test_gvisor_snapshot.py (a copy of a running writer spans one pass of it with the pause, several without), test_mcp_stdio.py (named mode), test_inject_gvisor.py and test_inject_mcp_stdio.py (against api.anthropic.com, which answers differently with and without the injected key), and the browser example. inject= was run with Python's urllib only; curl, git, Node and Go were not run against it. Not tested: Pool or aio over host="ssh://...", a browser together with egress=

v0.1.6

Choose a tag to compare

@cr-sbarbouche cr-sbarbouche released this 14 Nov 11:49
e9d8857
  • network="isolated": create_sandbox(network="isolated") puts the sandbox on one shared docker bridge, agvisor-isolated, created with inter-container traffic off. Sandboxes on it keep the internet but can't connect to each other's ports (the connection times out); files were never shared between sandboxes, this is only the network. The default is still "bridge" (docker0), so a host firewall written for docker0 keeps applying to existing setups; isolated sandboxes sit on a new bridge, so give it rules of its own. Docker's embedded DNS doesn't work under gVisor on user-defined networks (no name resolves, not even with --dns), so an isolated sandbox is given the resolver servers a sandbox on "bridge" gets. A network of that name that exists with inter-container traffic on is refused, not used. "isolated" is now a reserved network name
  • Limits(workspace="10g"): a hard cap on the /workspace volume of a named sandbox (the home for gui=True), which disk never covered, so a runaway process could fill the host's disk through it. It is an xfs project quota that docker sets on the volume (docker volume create --opt size=): past the cap writes fail with No space left on device, the sandbox keeps running, and the cap is still there after a stop(). It needs a host whose /var/lib/docker/volumes is on xfs mounted with pquota (setup in the README, Host setup); on any other host create_sandbox raises with docker's message instead of leaving the volume uncapped. The cap belongs to the volume and is fixed when it is created, like owner=: a different cap later, or a cap asked for on a volume made without one, raises ValueError (delete() it first, which erases its files); asking for no cap leaves the one it has. Named sandboxes only, off by default
  • examples/: seven small runnable scripts: quickstart, resuming and snapshots, limits, files and jobs, the egress allowlist, network="isolated" and the /workspace cap. CI runs every one of them against real gVisor, so they can't rot
  • Video: a one-minute walk through the two features, made from the real output of the examples on gVisor (attached: whats-new-0.1.6.mp4)
  • The firewall rule for the cloud metadata endpoint in the README (iptables -I DOCKER-USER -d 169.254.169.254 -j DROP) is now checked in CI against a fake metadata service on the runner (tests/test_gvisor_imds.py): a sandbox on "bridge" reads it, and stops reading it once the rule is in. That is a fake on the CI runner, not a real EC2 or Azure instance
  • CI: a new gvisor job runs every real-runsc test script and the examples on each push and pull request, on the runner's own docker, including test_mcp_stdio.py (agvisor-mcp driven over stdio by the real mcp client). Until now these were only run by hand
  • Tested on real gVisor (runsc 20261026.0, GitHub's Ubuntu 26.04 runner) with tests/test_gvisor_isolated.py and tests/test_gvisor_workspace.py, the cap on a loop-mounted xfs filesystem with pquota. Not tested: isolated or the cap on a real cloud VM, either of them with gui=True, and the /etc/fstab line in the README's xfs setup

v0.1.5

Choose a tag to compare

@cr-sbarbouche cr-sbarbouche released this 10 Nov 21:19
21f37f6
  • Egress allowlist: create_sandbox(egress=["pypi.org", "*.pythonhosted.org", "10.0.0.0/24:8080"]) instead of all-or-nothing network. The sandbox gets a private --internal network whose only other member is a small allowlist proxy; HTTP_PROXY/HTTPS_PROXY point at it, so pip, apt, curl and Python's urllib just work, and code that ignores them has no route. A name only gets through if it resolves to public addresses, so it can't reach 10.x, the docker host or the cloud metadata endpoint unless an entry says so. The proxy runs under docker's default runtime (runc), not gVisor, because docker's embedded DNS doesn't work under gVisor: it is the one component outside gVisor (about 150 lines, nobody, read-only, all capabilities dropped). Headless only, fixed at creation. agvisor prune and prune_egress() remove what expired sandboxes leave behind. agvisor-mcp takes AGVISOR_EGRESS for the same thing
  • Background jobs: sb.spawn(cmd, timeout=...) returns a Job at once, with poll(), wait(), read(offset) and kill(). It outlives the exec() and your process, and Job(sb, job_id) picks it up again. A running job does not keep an idle_ttl sandbox alive. agvisor-mcp: start_job, job_output and kill_job
  • Directories in and out: sb.put_dir(local, remote) and sb.get_dir(remote, local, max_bytes=50 MB). Links are copied as links and never followed on the way in; on the way out the tar is extracted with tarfile's data filter (nothing lands outside, no device files, no setuid bits), and links that point outside are left out and returned by name. agvisor put and agvisor get do the same from a shell
  • Python sessions: sb.python(code, timeout=60, restart=False) runs code in one long-lived interpreter inside the sandbox, so variables, imports and functions survive between calls, like notebook cells, and the value of a last expression is printed. At timeout the code gets a TimeoutError and the session survives. A Python exception is a traceback in stdout, not a return code. Needs python3 in the image; the session goes with the container
  • agvisor-mcp: new python, read_file, list_files and edit_file(path, old, new) tools. edit_file replaces one exact piece of text that must appear once, so the agent doesn't resend a whole file
  • agvisor-mcp: set AGVISOR_PUT_DIR=HOST_DIR:/DEST and a directory of yours is copied into the sandbox when it is made. It is skipped when /DEST already exists, so a resumed named sandbox keeps its edits. The whole directory goes through one tar in memory: keep it small
  • Tested on real gVisor over ssh:// (docker 29.1.3, runsc 20261102.0 and 20261026.0, Ubuntu 24.04) with tests/test_gvisor_egress.py, test_gvisor_jobs.py and test_gvisor_mcp.py: egress, jobs, directories, the agvisor put/get commands, and the MCP tools including python, edit_file and AGVISOR_PUT_DIR. The MCP tools were called as functions, not through a real MCP client

v0.1.4

Choose a tag to compare

@cr-sbarbouche cr-sbarbouche released this 09 Nov 12:18
6e5fdec
  • Snapshots for named sandboxes: sb.snapshot("clean") copies /workspace into a second volume in a throwaway gVisor container (no network), and sb.restore("clean") puts it back in a fresh container (processes are lost). list_snapshots() returns the tags, delete_snapshot(tag) frees one, and delete() removes them all with the sandbox. Each snapshot costs as much host disk as /workspace, which still has no size cap
  • Files in and out: sb.put(path, bytes) and sb.get(path, max_bytes=10 MB), through exec() with base64 (needs GNU coreutils in the image). get() reads regular files only and refuses more than max_bytes, because what comes out of a sandbox is untrusted
  • New agvisor command: agvisor ls, agvisor rm NAME... | --older-than SECONDS [--data] and agvisor exec NAME cmd..., with --host and --owner. rm never removes everything without a name or an age, so a retention job is agvisor rm --older-than 14400 in cron; --data also erases the files and snapshots of named sandboxes
  • agvisor-mcp: new write_file(path, content) tool, so the agent doesn't need a heredoc (it breaks on quoting and on very long content)
  • agvisor-mcp: set AGVISOR_NAME and the sandbox becomes a named one (/workspace kept in a volume, and reset() keeps it), and the agent also gets snapshot() and restore() over a single checkpoint slot. Unset, nothing changes. That volume has no size cap and is shared by every server process using the same name
  • Behaviour change: headless sandboxes now start with --entrypoint=. An image with an ENTRYPOINT used to take sleep infinity as its arguments and exit at once; it works now, but the entrypoint's own setup script no longer runs. The README and skill no longer say "never set an ENTRYPOINT"
  • Tested on real gVisor over ssh:// (WSL2 Ubuntu 24.04, docker 29.1.3, runsc release-20261102.0): snapshot, restore, list and delete, the ENTRYPOINT fix (the test fails without it), and the MCP named-mode functions called directly. put()/get() were run against a real container on runc and on gVisor. The agvisor command and write_file have unit tests only, and the MCP tools were not run through a real MCP client this time

v0.1.3

Choose a tag to compare

@cr-sbarbouche cr-sbarbouche released this 07 Nov 14:11
51c50fc
  • New agvisor-mcp: an MCP server so Claude Code, VS Code and OpenCode can run code in an agvisor sandbox instead of on the host. pip install 'agvisor[mcp]', then uvx --from 'agvisor[mcp]' agvisor-mcp (needs mcp>=2; the library itself still has no dependencies, and its API is unchanged)
  • Two tools, run(command, timeout) and reset(). Image, network (off by default), CPU/memory and expiry come from AGVISOR_* environment variables, so the agent can't choose them
  • One anonymous sandbox per server process: no /workspace volume and nothing shared between projects. It expires after 10 idle minutes or 1 hour; a sandbox killed for going over memory or pids is reported as "sandbox was reset", never silently re-run
  • README: new "Coding agents" section with setup for Claude Code, VS Code and OpenCode, and two links that were relative are now absolute (PyPI doesn't rewrite them)
  • An agent skill is in the repo under .claude/skills/agvisor/ (not part of the package): when to sandbox, and the gotchas
  • Tested on real gVisor over ssh:// (WSL2 Ubuntu 24.04, docker 29.1.3, runsc release-20261102.0): library 9/9, MCP server 11/11, and OpenCode 2.0.27 with a real model. Claude Code was tried against a stand-in docker, VS Code not yet

v0.1.2

Choose a tag to compare

@cr-sbarbouche cr-sbarbouche released this 06 Nov 18:32
1655416
  • list_sandboxes() handles now have .created (timezone-aware datetime) and .owner; list_sandboxes(owner=) filters
  • create_sandbox(name=, owner=): the first owner claims a named sandbox's data volume; a different owner, or none, gets PermissionError. Opt-in, not authentication; a volume made without owner= can't be adopted later (see README, Security)
  • list_sandboxes() output is parsed from tab-separated docker output, and named start() makes two more docker calls (volume create/inspect)
  • README documents the agvisor-desktop npm package

v0.1.1

Choose a tag to compare

@cr-sbarbouche cr-sbarbouche released this 06 Nov 08:02
d66dc93

What's Changed

  • Release 0.1.1: exec() raises SandboxGone; project URLs and typing metadata by @cr-sbarbouche in #3

Full Changelog: v0.1.0...v0.1.1