Skip to main content

openenv-openshell

openenv-openshell runs Hugging Face OpenEnv environment servers inside NVIDIA OpenShell sandboxes, under OpenShell filesystem, network, and credential policies. It implements OpenEnv's ContainerProvider interface, so existing OpenEnv clients and training loops keep working: you swap the provider, not the client.

env = GenericEnvClient.from_docker_image(image, provider=OpenShellProvider(...)).sync()

Restricted single-tenant alpha; v0.1.1 prepared for PyPI. The provider lifecycle, explicit policies, and cleanup are implemented and validated on a local OpenShell 0.1.2 gateway with OpenEnv 0.10.0. This alpha is supported only when one trusted operator exclusively controls the OpenShell gateway and workspace. It is not upstream-endorsed, and it is not safe for shared, multi-tenant, independently administered, or hostile-tenant deployments. See known limitations before relying on it. The v0.1.1 release notes describe the restricted release boundary; M2/M3/I14 remain the path to a broadly supported release.

Requirements

  • Python 3.11+.
  • An OpenShell 0.1.2 CLI and gateway with a working compute driver. Follow the local OpenShell setup; on Apple Silicon this is the native VM driver. openshell status must show the gateway connected at version 0.1.2.
  • The OpenShell 0.1.2 Python SDK (installed below; the openshell package on PyPI is a different, incompatible release).
  • Docker, to build the example images.

Install

From a checkout (includes the SDK and dev tools):

git clone https://github.com/rodrigosetti/openenv-openshell.git
cd openenv-openshell
uv sync --locked --all-groups

Into an existing virtual environment:

pip install "openenv-openshell @ git+https://github.com/rodrigosetti/openenv-openshell"
pip install 'openshell @ https://github.com/NVIDIA/OpenShell/releases/download/v0.1.2/openshell-0.1.2-py3-none-any.whl#sha256=8c409da4f176d42418d92366fe201f47cceef2c0fa432bfbce2bf938649d59cf'

The provider rejects any SDK version other than 0.1.2 before contacting a gateway. See SDK installation.

Quickstart

Run the upstream EchoEnv server in an OpenShell sandbox and talk to it with the unmodified OpenEnv client. From the repository root, with the gateway running:

# 1. Build the pinned EchoEnv image (native arm64 for the local VM driver).
docker build -t openenv-openshell-echo:quickstart \
  -f tests/integration/images/echo/Dockerfile tests/integration/images/echo
export OPENENV_OPENSHELL_ECHO_IMAGE_ID="$(docker image inspect --format '{{.Id}}' openenv-openshell-echo:quickstart)"

# 2. Run the quickstart.
uv run python examples/quickstart.py

Expected output (the sandbox name is random):

echo: hello from OpenShell
steps: 1
sandbox: openenv-sha2-d91afc
deleted: True

examples/quickstart.py is the whole program:

import os

from openenv.core.generic_client import GenericEnvClient

from openenv_openshell import OpenShellProvider

provider = OpenShellProvider(
    # Required for this restricted alpha's automatic, name-based cleanup.
    # Use only for an exclusive gateway/workspace controlled by one trusted operator.
    restricted_alpha_cleanup_acknowledged=True,
    # Exact server argv; OpenShell 0.1.2 does not run the image CMD for you.
    command=[
        "sh",
        "-c",
        "cd /app/env && uvicorn server.app:app --host 0.0.0.0 --port 8000",
    ],
    service_port=8000,
    policy="examples/policies/image-compatible.yaml",
    labels={"openenv.environment": "echo"},
)
image = os.environ["OPENENV_OPENSHELL_ECHO_IMAGE_ID"]
env = GenericEnvClient.from_docker_image(image, provider=provider).sync()
with env:
    env.reset()
    result = env.step(
        {
            "type": "call_tool",
            "tool_name": "echo_message",
            "arguments": {"message": "hello from OpenShell"},
        }
    )
    print("echo:", result.observation["result"]["data"])
    print("steps:", env.state()["step_count"])
    print("sandbox:", provider.metadata and provider.metadata.sandbox_name)
print("deleted:", provider.state.deleted)

This quickstart is only for the restricted-alpha boundary: before running it, ensure no independent or hostile actor can create or reuse sandbox names in this gateway/workspace. The acknowledgement does not make deletion atomic; it records that you accept the remaining risk. For a shared gateway, do not run this alpha—use keep_sandbox=True only for manual operator cleanup, or wait for the later atomic-deletion release.

What happens: the provider validates the command and policy offline, creates the sandbox with the policy and service route in one request, waits for OpenShell and then /health, and hands OpenEnv the routed URL. The client connects over WebSocket. Leaving the with block deletes the sandbox and waits until it is gone; a failed start is rolled back the same way.

To adapt it to your own environment image, change command, service_port, policy, and any env_vars the server needs. OpenShell 0.1.2 does not use the image's CMD, WORKDIR, or ENV. Read the image guide and pin the image by digest.

Something wrong? See troubleshooting.

Coding-agent demo

The canonical demo runs the upstream OpenEnv coding environment under a strict policy: it solves a task over the OpenEnv WebSocket, writes to /workspace, reaches pypi.org, is denied ~/.ssh, /host, and example.com, keeps the session working, and deletes the sandbox.

docker build -t openenv-openshell-coding:i8 examples/coding-agent
export OPENENV_OPENSHELL_CODING_IMAGE_ID="$(docker image inspect --format '{{.Id}}' openenv-openshell-coding:i8)"
make demo
✓ OpenShell sandbox created (oe-demo-e531c976, policy 5104817a61fe)
✓ OpenEnv server healthy
✓ WebSocket connected
✓ task executed (fizzbuzz via OpenEnv coding_env)
✓ approved filesystem access succeeded (/workspace)
✓ forbidden filesystem access denied (~/.ssh, /host)
✓ approved package index request succeeded (pypi.org)
✓ forbidden network request denied (example.com)
✓ OpenEnv session still healthy after denials
✓ sandbox deleted

The gateway needs internet access to pypi.org and example.com. The demo guide explains each check and its limits.

Documentation

Read the searchable user manual or browse the source guides. Preview locally with make docs-serve at http://127.0.0.1:8000/openenv-openshell/. See documentation contributions for the locked docs-only installation, strict build, and GitHub Pages deployment procedure.

Guide Contents
Configuration reference Every provider option, start arguments, policy, credentials, resources, metadata, errors, logging
Images Preparing images for OpenShell and pinning them immutably
Troubleshooting Errors by symptom, diagnostics, cleanup
Policy examples Strict, Hugging Face read-only, and image-compatible policies
Architecture Lifecycle, routing, failure recovery, metadata
Security Policy precedence, credentials, enforcement evidence, residual risks
Compatibility matrix Supported OpenEnv, SDK, and gateway versions
Local OpenShell setup Installing and checking the gateway and VM driver

SPEC.md holds the requirements and milestones.

Known limitations

  • Only OpenEnv 0.10.0 and OpenShell SDK/gateway 0.1.2 are supported. The OpenEnv pin includes automatic cleanup when the async factory is cancelled during its initial WebSocket connection. Failed cleanup still needs an explicit retry or operator inspection; see the cancellation contract.
  • Validated on the local native arm64 VM driver with locally built images. Their image IDs are not pullable registry digests. S5b also validated a digest-pinned amd64 EchoEnv image on a remote Docker driver with OIDC; arbitrary images and other compute drivers are unverified.
  • Remote gateways using the standard mTLS configuration are not supported for unmodified OpenEnv clients: service routes require a TLS client certificate the client cannot present. The provider fails with ServiceAccessError instead of timing out. S5b validated an OIDC-configured remote gateway with the unmodified async/sync client: lifecycle RPCs required a bearer token, but service routes were anonymous within the IP-restricted network boundary. OIDC gateway authentication does not protect those service routes. Edge authentication, HTTP 401/403 service challenges, long idle sessions, and reconnects remain unverified. See S5b remote evidence.
  • You must supply the server command, environment, and working directory; OCI ENTRYPOINT/CMD, ENV, and WORKDIR are not resolved.
  • Security milestones are incomplete: name-based cleanup can affect a sandbox that replaces it between identity lookup and deletion (SEC8c), and the local VM lane offers no process-capacity isolation against hostile workloads. This restricted alpha therefore requires restricted_alpha_cleanup_acknowledged=True before it starts an automatically cleaned workload, and supports only a trusted operator's exclusive gateway/workspace. Random names, labels, locks, lookup checks, and identity-aware waits are mitigations, not atomic deletion. Do not use it on a shared or multi-tenant gateway. It neither resolves SEC8c nor represents OpenEnv or NVIDIA endorsement. See the security guide.

Development

uv sync --locked --all-groups
make check        # Ruff format/lint, strict Pyright, unit tests with ≥95% branch coverage

Unit tests use typed fakes and need no OpenShell installation or gateway. Tests that need a real gateway are marked integration, live in tests/integration, and are opt-in:

make openshell-prereqs   # CLI/gateway versions and workspace access
make openshell-smoke     # disposable sandbox with an HTTP service route
OPENENV_OPENSHELL_ECHO_IMAGE_ID=... uv run pytest -m integration --no-cov tests/integration/test_quickstart.py
make integration         # every opt-in runtime test
make security-e2e        # filesystem and network denial jobs

The integration guide lists each suite and its image inputs; integration CI covers the gated runner.

The Quality workflow runs make check and builds the sdist and wheel on Python 3.11 through 3.14. To reproduce one job:

export UV_PYTHON=3.12 UV_LOCKED=true
uv lock --check
uv sync --locked --all-groups
make check
uv build --no-build-isolation

Release preparation is described in releases. Acceptance evidence for each milestone is recorded in M0, M1, the OpenEnv client check, and the security review. The Codex local environment runs uv sync --locked --all-groups for new worktrees.

The public repository is rodrigosetti/openenv-openshell; see the publication guide.

License

Apache-2.0; see LICENSE.

Metadata

Release files for openenv-openshell 0.1.1

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

Source distribution (sdist)

Source distribution for openenv-openshell 0.1.1
File Size Uploaded Provenance Actions
openenv_openshell-0.1.1.tar.gz 411.3 kB With provenance Details for openenv_openshell-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openenv-openshell 0.1.1
File Interpreter ABI Platform Actions
openenv_openshell-0.1.1-py3-none-any.whl Python 3 none any Details for openenv_openshell-0.1.1-py3-none-any.whl

Total release size: 440.8 kB

Release files / openenv_openshell-0.1.1.tar.gz

Download URL openenv_openshell-0.1.1.tar.gz
Size 411.3 kB
Tags Source
SHA-256 checksum
How to use checksums
283ca6a3339f745cb81d1b17d342367e41e6b0fffe4009883bfc323855092aae
BLAKE2b-256 checksum
How to use checksums
26682c0099e705cd6f01da66da3b5a71088a957a09c3210e6072320302ca139d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 26, 2026.

Transparency log

Release files / openenv_openshell-0.1.1-py3-none-any.whl

Download URL openenv_openshell-0.1.1-py3-none-any.whl
Size 29.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a6f0a078bc847c63f61951702eeb02ccb1b276a4d48c6103feeed17756c9d12b
BLAKE2b-256 checksum
How to use checksums
2aea546d840fb2f0ed9c9c811afd0cd84938c64f63a1320bd4dbab2c539b595f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 26, 2026.

Transparency log

Security for openenv-openshell 0.1.1

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 openenv_openshell-0.1.1.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 26, 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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

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