Getting started

Run the validated EchoEnv server under OpenShell with the unmodified OpenEnv client. This pre-alpha package is installed from source; run the commands from the repository root.

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.

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.