Skip to content
DeepLink-orgPublic

About

Run a coding agent in a staged workspace, review its file changes, and apply only what you keep.

Topics

Resources

Contributing

Security policy

Stars

28 stars

Watchers

0 watching

Forks

Latest commit

 

History

535 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PolicyVisor

PolicyVisor

A container runtime optimized for agent workloads

English · 简体中文

Get started · Documentation · Examples · 中文文档

CI Documentation License: Apache-2.0

pVisor supports a subset of Docker CLI commands and adds commands to review and accept an agent's changes.

  • Stronger isolation: Each container has its own Linux kernel, keeping the agent's tools separate from host processes and other containers.
  • Lower memory use: With page sharing enabled, agents using the same tools and libraries can share one copy of identical pages across VMs.
  • Faster tool startup: Lazy images load content on demand, so an agent can start a tool before the whole image downloads.

On Linux, mount a project with :stage to keep file changes out of your working tree. After the container exits, use review to see the diff, apply to keep selected paths, and drop to discard the rest.

Getting started

1. Install the CLI

With Python 3.10+:

python3 -m venv ~/.venvs/pvisor
source ~/.venvs/pvisor/bin/activate
python -m pip install pvisor-sandbox
pvisor --version

Installation covers Homebrew, native packages, and the platform checks for each example.

2. Try the CLI

Run a container

Prepare KVM on Linux x86_64 or Hypervisor.framework on Apple Silicon macOS, then run:

pvisor run --rm alpine:3.20 echo hello

Expect hello. The command runs in a separate Linux VM and removes its container after exit. First use downloads the image. Follow the Docker walkthrough to keep a sandbox running, execute another command, inspect it, and clean up. The experimental command subset includes image-based pvisor compose; it does not implement the Docker Engine API or the full Compose specification.

For the supported Unix command profile, alias docker=pvisor uses the same Session runtime: root inspect reports metadata, kill signals the current execution, and export writes a stopped container rootfs tar. Unknown commands fail rather than executing a host workload. Native tasks use explicit spawn or pvisor [SESSION_OPTIONS] -- COMMAND; options-only --config / --spec invocations remain supported. inspect --files selects a task filesystem view. A shell alias does not redirect SDK Docker sockets or subprocess executable lookup.

Review an agent task with native commands

If your tools are already installed locally, pvisor spawn --safe starts a Host Session with staged writes and no VM. Prepare FUSE and user namespaces on Linux x86_64, or macFUSE 5.4.0+ with FSKit on Apple Silicon macOS. Run these commands in a new demo directory:

mkdir pvisor-demo
cd pvisor-demo
pvisor spawn --safe --overlaynet-deny-all -- sh -c '
  echo "Hello from pVisor" > hello.txt
  echo "Temporary notes" > scratch.txt
'
pvisor review last --diff
pvisor apply last --path hello.txt
pvisor drop last
cat hello.txt

Expect Hello from pVisor. The greeting is now in your project; the notes were discarded. last selects the latest Session in this workspace. The staged task walkthrough checks the original directory, staged view, and final file state at each step. No model account or VM image is needed for this Host example.

3. Complete a task with your agent

The Claude Code tutorial walks through fixing failing tests in a small Python project. It includes the task prompt and credential setup, then shows how to check staged files, accept them, and retest in your project. You need Python, Claude Code, and model access.

Developer preview: approval-free agent operation still needs validation for cloud models and approval behavior. The agent guide lists the recorded controlled-client tests. pVisor does not automatically disable agent or IDE approvals.

--safe fails if required controls cannot be installed. Ordinary Host Sessions write through by default. File acceptance does not undo remote API calls, database writes, charges, or previously applied files. See security boundaries.

Review changes from a container (Linux preview)

Mount the project with :stage to review changes before writing them back:

mkdir project
pvisor run --name edit -v ./project:/workspace:stage alpine:3.20 \
  sh -c 'echo "Hello from a VM" > /workspace/hello.txt'
pvisor review edit --diff
pvisor apply edit --path hello.txt --dry-run --diff
pvisor apply edit --path hello.txt
pvisor rm edit

:stage is a pVisor extension; ordinary :ro and :rw mounts keep their existing behavior. Only staged binds write results back to recorded host sources, not the instance rootfs. Review after exit; multiple staged binds require --mount. Staged binds cannot use --rm or mix with direct-writable mounts. Use drop for remaining candidates when needed before removing the instance. See mount selection and lifecycle.

On Linux x86_64/KVM, a build from main can also run host-installed tools with pvisor run @root without pulling an image. It can read the live host filesystem, including readable credentials. Use -v ../experiment:/:stage to choose where to retain changes.

Execution and integration

pVisor also supplies execution environments for agentic inference, evaluation, and RL post-training. Resource sharing and idle-memory reclamation help manage machine capacity; execution records and staged changes help you review results. Capabilities depend on the interface, executor, and platform.

  • Native Sessions: use pvisor spawn with Host, OCI, or VM execution and explicit staging for review/apply.
  • Agent plugins: Pi, DSH and Codex task adapters use native spawn → review → apply/drop; built-in Agent tools remain separate.
  • Embedded runtime: integrate the Rust runtime.
  • Platform APIs: use the local daemon for partial OpenSandbox/E2B SDK profiles on Linux/KVM, or the containerd shim.
  • Container workflows: the experimental Docker-style CLI runs one VM per container.

These interfaces have separate lifecycle and capability contracts. Daemon APIs do not expose native Session stage/apply semantics. Container staged binds have their own review/apply/drop contract. Start with the VM tool-execution tutorial for a caller-script example, or consult the integration matrix.

Try the experimental Rust guest kernel

On Linux x86_64 with KVM, use a pvisor build that embeds the Rust guest kernel (mise run build builds one from this checkout). Select it for a single run:

PVISOR_GUEST_KERNEL=rust-native pvisor run --rm --cpus 2 --memory 16m alpine:3.20 echo hello

Expect hello. The environment setting applies only to this command. Linux remains the default; if you exported the variable, run unset PVISOR_GUEST_KERNEL to switch back. The Rust profile on x86_64 supports 1–64 vCPUs with at least 16 MiB or 1.5 MiB per vCPU rounded up, whichever is larger. Workloads may need more RAM. Snapshot and restore are not supported. See the Rust guest kernel README for details.

Documentation

Contributing

See CONTRIBUTING.md to set up the toolchain and run targeted checks. Ask questions in Discussions and report vulnerabilities through SECURITY.md.

License

Apache-2.0. See NOTICE for bundled third-party components.

About

Run a coding agent in a staged workspace, review its file changes, and apply only what you keep.

Topics

Resources

Contributing

Security policy

Stars

28 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages