/virtx:virtxfrom virtx
Runs tasks in disposable Linux microVMs from Python, Node.js, or Rust. Use for sandboxing untrusted code, isolating heavy dependencies, or GPU workloads without Docker.
Ships in virtx. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A sandbox is a Linux microVM a virtx server boots from an image, in which you run commands and read what they wrote. The server keeps what outlives a sandbox, apart from it: images to boot, and volumes mounted into sandboxes, whose files the client reads and writes directly. A sandbox is gone when you remove it, and nothing it did outlives it but what it wrote to a volume. So "run this somewhere disposable" is a few requests, not an environment you set up.
virtx works under any AI agent: a sandbox is a tool like any other, and the steps below are the same whether a program or a model drives it.
Work the steps below in order. Step 2 is the one that gets skipped: a command that needs a tool the image lacks fails inside the VM, not on the host.
| Language | Install | Import |
|---|---|---|
| Python | pip install virtx | from virtx import Client, Recipe |
| Node.js | npm install @brekkylab/virtx | const { Client, Recipe } = require('@brekkylab/virtx') |
| Rust | cargo add virtx | use virtx::{Client, Recipe}; |
A client reaches one server: Client.spawn() (Client::spawn_virtx in Rust) starts it on this machine as a child process, fetching the server of the client's own version into a cache the first time, and Client.connect(url, auth) reaches one over HTTP, with a bearer token if it wants one. Client.spawn("virtx-stdio") starts one installed on PATH instead; ensure_virtx() (ensureVirtx()) does the fetch alone, ahead of time. The Python and Node packages carry the library; the Rust crate opens libvirtx_core at run time, from virtx::load(path) or $VIRTX_CORE_LIB.
Every Python request is a coroutine and every log an async iterator. In Node they are promises and async iterables, with names in camelCase. In Rust each is a Future or a Stream, awaited with .await in an async runtime such as Tokio; a started job's log is its .log(), read with StreamExt::next, and a job's .complete(print) is awaited for how it ended.
digest = await client.build_image(Recipe("alpine:latest").run("apk add --no-cache jq"), "jq:latest").complete(print=True)
Recipe is a base image plus steps, as a Dockerfile is. A build stores what it builds under its tag; build once and boot many sandboxes from it, rather than installing in each.pull_image("python:3.12-slim-trixie") takes an image from a registry as it is.complete follows it to its end and answers its digest, printing its log with print=True; one that fails raises VirtxError with why. Let it complete before booting from the tag. Iterating what it answers reads its log instead, which raises the same error in place of its end entry; awaiting it gives the job, whose log job.log() reads later.alpine:latest boots fastest, python:3.12-slim-trixie or debian:trixie-slim when the task wants glibc or pip wheels.sandbox = await client.create_sandbox("jq:latest", volumes=[SandboxVolume(volume="data", path="/data")])
| The task needs | At create_sandbox |
|---|---|
| files it shares with the host or later sandboxes | a volume, made with create_volume, in volumes as SandboxVolume(volume, path, readonly), the Volume or its name |
| files it must not change | the same, with readonly=True |
| room to install more than 2 GiB over its image | disk_gib=8, or as much as it needs |
| what it installs kept for the next sandbox | an image with it installed, built with build_image, as the image each sandbox is made of |
| a server in it reached from here | ports=[8000], then await PortForwarder.open(sandbox, 8000), reached at its local; a connection closed at once usually means nothing listens there yet; forwarder.last_error and a warning of the virtx logger say what the server answered, and last_error is None again once a connection gets a byte back |
| no network | network=False; on unless turned off |
| the host's GPU | gpu=True, and a Vulkan loader plus the venus driver in the image; the server refuses the sandbox if it cannot give one |
| more CPUs or memory | vcpus=, memory_mib= |
Give it what the task must read or keep, and nothing more. Put input files in a volume first, from the host, with await volume.write_file("in/a.txt", content) on the Volume that create_volume or get_volume answered. Guest paths are absolute.
code = await sandbox.exec(["sh", "-c", "jq --version"], timeout_ms=10_000).complete(print=True)
exec takes an argv, not a shell string: wrap in ["sh", "-c", ...] when the command needs a shell. What it answers is a job: completed, its exit code, its output printed with print=True; iterated, the command's output, a line per entry, then its exit code as the last entry; awaited, a SandboxJob, for the requests below. A nonzero exit code is the answer, not an error. A sandbox runs many commands at once, each its own job, and leaving the loop leaves the command running.
exec, and makes no job.stdin=True keeps its stdin open for the job's write_stdin, each write awaited before the next, until one closes it with eof=True.job.signal("SIGTERM") signals it; job.remove() kills it and forgets it; job.log(after=...) reads its log again.after the last entry's id. A long one is cut at the server's limit, with one truncated entry, and still ends with end.Look at the volume, with its read_file or read_dir, or at the log's lines, rather than at the exit code alone: a command that printed "done" but wrote outside every volume has written nothing that outlives the sandbox. If a file is missing, the usual causes are a path outside the volumes, a read-only volume, or a step the image needed and lacked.
Remove the sandbox with sandbox.remove() when the task is done, in a finally: it stays until removed, and what it wrote outside its volumes goes with it.
README.md: the Quickstart, for a local server and a remote one.docs/content/: the guides and the API reference.docs/content/reference/protocol.mdx: what client and server say to each other, for a server of your own.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub brekkylab/virtx --plugin virtxOther plugins' skills for the same job