Skip to main content
PolicyVisor

PolicyVisor

An agent-native sandbox framework

English · 简体中文

Get started · Documentation · Examples · 中文文档

CI Documentation License: Apache-2.0

pVisor is a sandbox framework with two modes. Docker style sandbox runs each container in its own VM. Agent style stagebox is pVisor's original mode for coding agents: with staging enabled, file changes stay staged until you review them and choose what to keep.

Two modes

Mode Workflow Boundary and results
Docker style sandbox Use familiar image, run, exec, stop, and remove commands One Linux VM per container; container lifecycle and file operations
Agent style stagebox Let an agent experiment, review staged changes, and choose what to keep Native Sessions with explicit staging and review/apply/drop; isolation depends on the selected executor

Hands-off vibe coding.

Coding without sandbox approvals.

In Agent style stagebox mode, let the agent try changes in a staged workspace, then review the files and accept what you need. Approval-free operation still requires validation for each agent and configuration; the setup guide states the current evidence and limits.

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 mode.

2. Choose a mode

Docker style sandbox

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.

Agent style stagebox

For the Host stagebox example, 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 stagebox 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 stagebox 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.

Linux preview: host tools and staged container binds

For system-tool experiments, pvisor stage runs host-installed tools in a Linux VM and keeps rootfs changes for review. Apply defaults to the recorded project; environment changes remain staged. Host files stay readable, and the live host filesystem is not a snapshot. System writeback is a separate privileged operation, not an OS upgrade transaction.

pvisor stage -it --stage ../pvisor-experiment
# Use the shell, then exit before reviewing.
pvisor review ../pvisor-experiment --diff
pvisor apply ../pvisor-experiment --path src --dry-run --diff
pvisor apply ../pvisor-experiment --path src
pvisor drop ../pvisor-experiment

Only discard remaining candidates after checking them. If all changes were accepted, skip drop. See stage setup and limits.

Container commands also support staged project binds on Linux:

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.

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.

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.

Metadata

Release files for pvisor-sandbox 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for pvisor-sandbox 0.4.0
File Interpreter ABI Platform Actions
pvisor_sandbox-0.4.0-py3-none-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64, Linux glibc 2.5+ x86-64 Details for pvisor_sandbox-0.4.0-py3-none-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
pvisor_sandbox-0.4.0-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for pvisor_sandbox-0.4.0-py3-none-macosx_11_0_arm64.whl

Total release size: 55.4 MB

Release files / pvisor_sandbox-0.4.0-py3-none-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

Download URL pvisor_sandbox-0.4.0-py3-none-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Size 28.4 MB
Tags Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 Python 3
SHA-256 checksum
How to use checksums
7b0d02eacb84a3ef9c415c88b5d9a691a2fd066fad30bd2ace4080bedb4ce0bf
BLAKE2b-256 checksum
How to use checksums
57acaf56a512d350621cff1bcbb16375b208abd3c866620ed46ac32e8ef8d873
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / pvisor_sandbox-0.4.0-py3-none-macosx_11_0_arm64.whl

Download URL pvisor_sandbox-0.4.0-py3-none-macosx_11_0_arm64.whl
Size 27.0 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
2eb0cac53855d9f73a145ab05c94b279fc22a2c70fe34c69832f2aabd2980d98
BLAKE2b-256 checksum
How to use checksums
330c7c876085785d66cacede5a4cacb88f9b2bb8d7907224e0f48eda54ecd2ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for pvisor-sandbox 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pvisor_sandbox-0.4.0-py3-none-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page