Skip to main content
Incomplete provenance

1 of 5 release files were uploaded without provenance metadata. View details.

nex-box ⚡

Sub-millisecond, zero-copy, kernel-level execution sandbox for autonomous coding agents.

PyPI version License Platform Rust

nex-box solves the fundamental dilemma of autonomous AI engineering: how to let coding agents run untrusted tests, builds, and destructive file mutations without risking host corruption or waiting seconds for Docker.

Backed by macOS APFS clonefile(2), Linux ioctl(FICLONE) copy-on-write primitives, and non-privileged fuse-overlayfs fallback, nex-box instantiates ephemeral scratch workspaces in under 3 milliseconds, traps all file mutations and network sockets at the kernel layer, and guarantees instant atomic rollback on failure or zero-copy promotion on success.


Architectural Topology (v0.2.0 Hardened)

                  HOST WORKSPACE (Pristine Inode Root)
                                   │
              ┌────────────────────┴────────────────────┐
              │ clonefile(2) / ioctl(FICLONE) / Overlay │ < 2.5ms Latency
              ▼                                         ▼
   EPHEMERAL SCRATCH ROOT                    KERNEL CONFINEMENT ENCLAVE
   (.nexbox/sessions/box_xxx)                 ├── macOS Seatbelt: (deny network*)
              │                               └── Linux: unshare(CLONE_NEWNET)
              ├─────────────────────────────────────────┤
              │ COMMAND EXECUTION & WATCHDOG TIMER      │
              │ ├── Process Group Teardown (killpg)     │
              │ ├── Scratch Log I/O (Anti-Pipe Lock)    │
              │ └── Hard millisecond SIGKILL watchdog   │
              ├─────────────────────────────────────────┤
              │ STAT-INDEXED BLAKE3 SIMD ENGINE         │
              │ ├── Stat-gate (mtime + size filter)     │
              │ ├── Rayon parallel SIMD byte hash       │
              │ └── Extracts: Created, Modified, Deleted│
              └────────────────────┬────────────────────┘
                                   │
                    ┌──────────────┴──────────────┐
                    ▼                             ▼
           EXIT CODE 0 & --commit        EXIT CODE != 0 / TIMEOUT
                    │                             │
                    ▼                             ▼
        [ATOMIC PROMOTION]               [AUTOMATIC ROLLBACK]
   Reflink changes to host tree.    Instant purge of scratch tree.
   Host updated in microseconds.    Host remains 100% untouched.

What's New in v0.2.0

  1. Process Group Teardown (killpg): Watchdogs now isolate and disarm whole process groups (setpgid(0, 0) + killpg(pgid, SIGKILL)). Multiprocessing test harnesses, daemonized subprocesses, and background fork-bombs are killed immediately without orphaning zombie workers.
  2. OverlayFS Fallback for Linux ext4: Auto-detects filesystems lacking native reflink support (e.g. ext4) and dynamically backs the scratch space using fuse-overlayfs or high-throughput parallel Rayon cloning. Dangerous shared hardlinks are completely eradicated.
  3. Cross-Volume Boundary Protection: Strict st_dev invariant check ensures the workspace root and .nexbox/ storage share the same physical filesystem partition, preventing silent fallback slowdowns or EXDEV link corruptions.
  4. Stat-Gated BLAKE3 SIMD Acceleration: Files with matching byte size and nanosecond modification timestamps skip hash calculations, speeding up diff computation on large repositories ($\ge 10,000$ files) to single-digit microseconds.

Installation

pip install nex-box
# or with uv:
uv pip install nex-box

Via Cargo:

cargo install nex-box

Quickstart

1. Python API (import nex_box)

import nex_box

outcome = nex_box.run(
    command=["pytest", "tests/"],
    commit=True,          # Automatically commit to host ONLY if exit code == 0
    timeout_ms=5000,      # Hard watchdog killpg after 5.0 seconds
    allow_net=False       # Kernel-level network socket isolation
)

if outcome.is_success():
    print(f"Verified in {outcome.duration_ms}ms (Strategy: {outcome.strategy})")
    print(f"Cloned in: {outcome.clone_duration_micros}µs")
    print(f"Files Modified: {outcome.diff.files_modified}")
else:
    print(f"Agent failed with exit code {outcome.exit_code}")
    print(outcome.stderr)

2. Standalone CLI (nex-box)

# Run untrusted commands in an ephemeral scratch sandbox
nex-box run -- bash -c "echo 'mutation' > test.txt && pytest"

# Atomic commit gated on exit code 0
nex-box run --commit -- python3 -m py_compile module.py

# Timeout enforcement with full process-group killpg
nex-box run --timeout-ms 2000 -- python3 -c "import time; time.sleep(10)"

# Air-gapped execution
nex-box run --allow-net false -- curl -I https://github.com

License

Dual-licensed under either of:


### File 4: src/lib.rs
```rust
//! src/lib.rs - Root library entrypoint exporting main components and PyO3 C-extension.

pub mod main_components;

#[cfg(feature = "python")]
use pyo3::prelude::*;

#[cfg(feature = "python")]
use main_components::python_bindings::{run, PySandboxOutcome, PyWorkspaceDiff};

/// Python native C-extension module entrypoint
#[cfg(feature = "python")]
#[pymodule]
fn nex_box(m: &Bound<'_, PyModule>) -> PyResult<()> {
    m.add_function(wrap_pyfunction!(run, m)?)?;
    m.add_class::<PySandboxOutcome>()?;
    m.add_class::<PyWorkspaceDiff>()?;
    m.add("__version__", env!("CARGO_PKG_VERSION"))?;
    Ok(())
}

Metadata

Release files for nex-box 0.2.0

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

Incomplete provenance

1 of 5 files were uploaded without provenance metadata.

We recommend further investigation before installing these files. View details.

Source distribution (sdist)

Source distribution for nex-box 0.2.0
File Size Uploaded Provenance Actions
nex_box-0.2.0.tar.gz 29.6 kB With provenance Details for nex_box-0.2.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for nex-box 0.2.0
File Actions
nex_box-0.2.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details for nex_box-0.2.0-cp312-cp312-macosx_11_0_arm64.whl
nex_box-0.2.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details for nex_box-0.2.0-cp311-cp311-win_amd64.whl
nex_box-0.2.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details for nex_box-0.2.0-cp311-cp311-macosx_11_0_arm64.whl
nex_box-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.12+ x86-64 Details for nex_box-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl

Total release size: 1.2 MB

Release files / nex_box-0.2.0.tar.gz

Incomplete provenance

This file belongs to a release with incomplete provenance: while this file has provenance metadata, other files in this release do not.

We recommend further investigation before installing this file. View details.

Download URL nex_box-0.2.0.tar.gz
Size 29.6 kB
Tags Source
SHA-256 checksum
How to use checksums
6c724e97cfc6ca35bd0b4e8678eb57dcea3d2f6ae804b6aabcb26f863a338de4
BLAKE2b-256 checksum
How to use checksums
908fb4ebb641912e7a0bfe298958013cc32955d028b3d3290f1104b0c745c62c
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 Oct 29, 2026.

Transparency log

Release files / nex_box-0.2.0-cp312-cp312-macosx_11_0_arm64.whl

Incomplete provenance

This file belongs to a release with incomplete provenance: while other files in this release have provenance metadata, this file does not.

We recommend further investigation before installing this file. View details.

Download URL nex_box-0.2.0-cp312-cp312-macosx_11_0_arm64.whl
Size 300.3 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
7f4879b42c265ccd2fd14d2e46fcd9c4e23818a223e330bf24b58ad244165b68
BLAKE2b-256 checksum
How to use checksums
5bcac50cd17c0699bc093253e6baeb6a378fac66655a3992d1c3f2feac0be1a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.4.30

Release files / nex_box-0.2.0-cp311-cp311-win_amd64.whl

Incomplete provenance

This file belongs to a release with incomplete provenance: while this file has provenance metadata, other files in this release do not.

We recommend further investigation before installing this file. View details.

Download URL nex_box-0.2.0-cp311-cp311-win_amd64.whl
Size 266.4 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
8bb2d13fcbfc66a1a48e678152a725833eba4657d83057b58e7206dbef4fecd9
BLAKE2b-256 checksum
How to use checksums
f847fd14ec1c9a5fe47c8a65259ac4c87d69f25e627a868493dfa105e2bb7d9d
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 Oct 29, 2026.

Transparency log

Release files / nex_box-0.2.0-cp311-cp311-macosx_11_0_arm64.whl

Incomplete provenance

This file belongs to a release with incomplete provenance: while this file has provenance metadata, other files in this release do not.

We recommend further investigation before installing this file. View details.

Download URL nex_box-0.2.0-cp311-cp311-macosx_11_0_arm64.whl
Size 287.6 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
87655e556faa85c415271dcc90e509653a580024673de0b6ae27e67373df102a
BLAKE2b-256 checksum
How to use checksums
fb106a850e8cc9308c87124f7f8a511252cd81c6ca2c490d5652bb0a07d4df5e
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 Oct 29, 2026.

Transparency log

Release files / nex_box-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl

Incomplete provenance

This file belongs to a release with incomplete provenance: while this file has provenance metadata, other files in this release do not.

We recommend further investigation before installing this file. View details.

Download URL nex_box-0.2.0-cp311-cp311-macosx_10_12_x86_64.whl
Size 316.6 kB
Tags CPython 3.11 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
0fa855309546035750f79c7963706dca7847822a6d4592423798cef374249d0a
BLAKE2b-256 checksum
How to use checksums
f3b67014e56bc43b1d987c48efe5869fb10d4738538f0f228075184643129a01
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 Oct 29, 2026.

Transparency log

Security for nex-box 0.2.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.

Incomplete provenance

1 of 5 release files were uploaded without provenance metadata.

Files with provenance 4 / 5
Files without provenance 1 / 5
Select from 5 files

Attestation for nex_box-0.2.0.tar.gz

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 Oct 29, 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