> ## Documentation Index
> Fetch the complete documentation index at: https://aivision.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Read the relevant procedure and prerequisites before suggesting commands. Cite the section and give an observable check. Treat sample data as illustrative. Report product actions and results only when verified in the user's environment.

# Install the OpenShell sandbox plugin

> Run one automatic command on the deployment host, confirm the Space connection and default, or use the advanced existing-gateway path.

This page is for self-hosted platform operators and Space administrators. The recommended path prepares one command in the web UI. Run it on the **AI Vision deployment host** to install a dedicated OpenShell gateway and plugin, then save the current Space connection. The default flow asks for no images, gateway addresses, paths, endpoints or service tokens. Manual installation against an existing gateway remains an advanced path below.

> [!NOTE]
>
> Use the matching CLI that explicitly supports `aiv plugin setup openshell`, and a deployment that provides the OpenShell artifact catalog. Missing catalog or deployment identity produces an actionable explanation. Source or local QA images are not proof of published packages or acceptance on another architecture/host. OpenShell remains optional and outside the default five services.

## Recommended: install with one deployment-host command

### 1. Check the host and copy the command

Switch to the target Space and open **Integrations → Plugins → Sandbox → OpenShell → Install OpenShell**. There is no technical configuration form. Confirm terminal and Docker management access on the deployment host, then choose **Copy install command** in the footer. This prepares and copies the complete command without image, gateway, path, endpoint or token inputs.

The actual Docker Engine must be **28.0 or newer**. The actual Linux execution environment must have **Landlock ABI 3 or newer enabled** (normally Linux 6.2+, but distribution backports and configuration affect support). Installation checks real capability; an OS or kernel version alone is insufficient. Default setup uses the deployment host's local Docker Unix socket, not a remote Docker context.

Use the CLI included with this deployment version. Update older CLIs first; check the capability with read-only help:

```bash theme={null}
aiv plugin setup openshell --help
```

[![Current English install drawer shows host requirements and compact footer without technical inputs](https://mintcdn.com/aivision/W8FwR0B7OvfGW_UI/assets/figures/openshell-current-intro.en.webp?fit=max\&auto=format\&n=W8FwR0B7OvfGW_UI\&q=85\&s=af4c9ab20bb06a96bae7a006adbd90e7)](https://aivision.mintlify.site/assets/figures/openshell-current-intro.en.webp)

Current installation drawer · Running frontend with API demonstration data · Click to enlarge

### 2. Run it on the actual deployment host

Paste and run the complete copied command in a terminal on the host running this AI Vision deployment. **Copying does not start installation.** Do not run it on an arbitrary laptop or another Docker daemon. The browser and backend execute neither Docker nor a remote shell.

The command carries three separate short-lived capabilities for the pinned plan, progress and connection enrollment. Uppercase names in the preview mask them; the copied command already includes their values. Refreshing cannot retrieve them again. Do not publish the complete command, tokens or host-private files.

[![Current English command preview uses uppercase names for hidden capabilities](https://mintcdn.com/aivision/W8FwR0B7OvfGW_UI/assets/figures/openshell-current-command.en.webp?fit=max\&auto=format\&n=W8FwR0B7OvfGW_UI\&q=85\&s=59f4aa3512014102cfb8a78678864c8a)](https://aivision.mintlify.site/assets/figures/openshell-current-command.en.webp)

Current command preview · API demonstration data; capabilities masked · Click to enlarge

### 3. Check progress and the reason for stopping

| Page state | Meaning and next step |
| - | - |
| Waiting for the deployment host | No progress has arrived. Check the target host, terminal errors and host-to-AI-Vision connectivity. |
| Host / images / configuration / gateway / plugin | Real phases, elapsed time and last update; expand installation events for details. No estimated global percentage. |
| Host requirement or stage failed | Read the stopped stage, detected value, minimum requirement and repair guidance. Ask the administrator to repair it, then copy and run a new command. Existing state and the old error remain. |
| Service installed; provider not ready | A running container does not prove readiness. Inspect host output and the provider; do not delete state to reinstall. |
| Service ready; connection not saved | Wait for enrollment; recover registration against the owned installation if it fails. |
| Space connection saved | The server saved and tested the connection. Rule execution and cleanup still need verification. |

Closing, reopening or reloading the drawer resumes reads only. One request failure or 20 seconds without an update does not prove host failure. If you ran the previous command, keep waiting; otherwise regenerate explicitly. A new record retains the old record and does not stop its host command. The CLI reuses only resources matching the exact owned plan.

### 4. Set the Space default explicitly, then test a rule

After **Space connection saved**, the compact footer places **Close** beside **Set as Space default**. The server retests and confirms the binding. Once **Space default set** appears, the footer contains only **Done**. Closing during installation does not stop the host command. Low-frequency actions for rechecking a repaired host or ending progress reporting stay in collapsed sections of the scrollable body.

[![Current English saved installation has adjacent Close and Set as Space default actions](https://mintcdn.com/aivision/W8FwR0B7OvfGW_UI/assets/figures/openshell-current-registered.en.webp?fit=max\&auto=format\&n=W8FwR0B7OvfGW_UI\&q=85\&s=469d6b4516222b80eb57ea5c5dbc183a)](https://aivision.mintlify.site/assets/figures/openshell-current-registered.en.webp)

Current saved connection and compact actions · API demonstration data · Click to enlarge

Installation and enrollment do not automatically change the default or enable “Require sandbox execution for custom rules.” Follow [Run custom rules in a sandbox](https://aivision.mintlify.site/en/guides/sandbox.md) to select execution and try a reviewed Trace. For a formal Task, also inspect its individual diagnosis Record and execution status; Task completion alone is insufficient. Verify cleanup independently. A new default does not rewrite frozen targets of existing Tasks.

[![Actual English read-only view of the existing Linux AMD64 installation; compact footer contains only Done](https://mintcdn.com/aivision/W8FwR0B7OvfGW_UI/assets/figures/openshell-current-real-default.en.png?fit=max\&auto=format\&n=W8FwR0B7OvfGW_UI\&q=85\&s=acacb04e0eef1867d54d810d9614b610)](https://aivision.mintlify.site/assets/figures/openshell-current-real-default.en.png)

Actual Linux AMD64 VM: confirmed default, only Done remains · Read-only English view · Click to enlarge

Automatic setup prints `Owned state: ...`; failures also retain and report existing state. Keep that path. Later `status`, `logs` and `remove` use its `installation` subdirectory as `--state-dir`. Plugin removal retains the dedicated gateway and private files. An operator must handle the gateway separately after confirming no leases remain. Do not clear state or journals to retry.

## Confirm enhancement support and effective limits

The matching installation provides one enhanced Python environment with importable **pytest, NumPy, pandas, Pydantic, jsonschema and openpyxl**, reference-test execution and JSON/CSV/XLSX materials. Rule authors load examples in the editor without entering images, Python paths or package-install commands. **Available libraries** reports the actual environment; ordinary connection readiness alone does not qualify the enhanced runtime.

New automatic installations use recommended connection limits of **1 CPU, 1 GiB and 30 seconds**. Existing connections keep their configured limits. Actual execution uses the smaller of the enhanced service ceiling and the connection limit. **Apply recommended limits** raises only insufficient values for a compatible, manage-authorized connection; it cannot raise the service ceiling or upgrade an old plugin.

If the editor says **Plugin update required**, check the matching platform, Task workers, plugin and enhanced workload versions. Early manual or prototype installations have no automatic in-place upgrade guarantee. Follow [Safe removal and upgrades](#safe-removal-and-upgrades) for the original installation, then install the matching delivery. A budget edit alone is not an upgrade.

Use the [starter and advanced rule examples](https://aivision.mintlify.site/en/guides/sandbox.md#rule-examples) to check imports, reference tests and data comparison, then independently confirm cleanup. Source/local QA, readiness and historical screenshots do not replace execution on the current image or establish publication, another architecture or native-private delivery qualification.

[![Actual Linux AMD64 VM rule editor shows sandbox execution, 30-second budget and six library versions in Chinese](https://mintcdn.com/aivision/dV2TtZMAp3g6qPp1/assets/figures/openshell-vm-enhanced-rule.zh-CN.png?fit=max\&auto=format\&n=dV2TtZMAp3g6qPp1\&q=85\&s=971e953858506992dfd0e991f6ce406f)](https://aivision.mintlify.site/assets/figures/openshell-vm-enhanced-rule.zh-CN.png)

Actual Linux AMD64 VM: saved rule, enhanced Python and six libraries · Chinese interface · Click to enlarge

## Advanced: manual deployment with an existing gateway

The following steps are only for operators who already manage an independent OpenShell gateway. Manual `aiv plugin install openshell` does not install that gateway; it manages the separate plugin service. The recommended automatic flow does not ask for these fields or require manually generated private files.

### Prerequisites

| Requirement | What must be ready |
| - | - |
| **CLI and platform** | `aiv plugin install openshell --help` works, and the platform has **Integrations → Plugins → Sandbox → OpenShell**. During an upgrade, coordinate the entire worker pool to support the new task format before creating new tasks. |
| **Existing OpenShell gateway** | The current provider integrates with OpenShell `0.1.6`. Supply a `host:port` reachable inside the plugin container and any required gateway authentication/TLS files. |
| **Plugin image** | An explicit compatible image reference. Use the matching source-selfhost or native-private recipe in the [image preparation instructions](https://github.com/ob-labs/ai-vision-ob/blob/f667934e028294dd851e46a71e805b855272ad78/agentlens/docker/README.sandbox-plugin.md); their base-image requirements differ. |
| **Workload image** | An explicit image containing `/app/src/agentlens-rule-worker`, allowing nonroot execution and verified against the policy and actual execution path. |
| **Exclusive workspace and journal** | One durable lease journal exclusively operates one workspace. On a shared gateway, explicitly set `--workspace`; use the default workspace only on a dedicated gateway. Other clients and administrators must not delete or recreate plugin-owned names. |
| **Cleanup verification socket** | The Unix socket of the same Docker daemon actually used by the OpenShell gateway. Another responsive daemon cannot prove workload deletion. |

**Source-selfhost:** `Dockerfile.sandbox-plugin.selfhost` requires both `AGENTLENS_SOURCE_IMAGE` and `RULE_WORKER_IMAGE`; it copies the qualified runtime inventory from the worker image. **Native-private:** `Dockerfile.sandbox-plugin` requires a native base that already contains the compiled plugin modules. That native-base requirement applies to this recipe, and native-private artifacts require separate qualification; source QA does not establish it.

The plugin independently verifies cleanup with read-only Docker requests. Mounting a socket read-only does not restrict Docker API permissions; this is a trusted operator service. Do not expose the socket to workloads or the platform web service. Use a dedicated execution host or Docker daemon where possible.

OpenShell `0.1.6` deletes resources by name. Its API has no atomic immutable-ID/version precondition for deletion. The plugin checks observed identities, but cannot prevent a gateway administrator from replacing a resource with the same name between requests. Exclusive workspace operation and trusted gateway administration are therefore deployment prerequisites.

### 1. Check the actual CLI capability

Run on the Docker host that will run the plugin container:

```bash theme={null}
docker info
aiv plugin install openshell --help
aiv plugin status openshell --help
aiv plugin remove openshell --help
```

`docker info` must reach the intended daemon. If the CLI does not recognize `plugin` or `openshell`, follow [Install the CLI](https://aivision.mintlify.site/en/guides/install-cli.md) to obtain a matching build that explicitly includes this capability. Do not infer support from a `dev` tag or reuse flags from other `aiv` subcommands.

### 2. Prepare private files and the execution policy

The following example generates a random plugin HTTP token in a configuration directory. For an existing installation, reuse its original directory and lease journal; **do not overwrite the token or clear the journal**. Run this only for a first installation after confirming the directory is unused:

```bash theme={null}
umask 077
AIV_SANDBOX_CONFIG="$HOME/.aivision/openshell-config"
mkdir -p "$AIV_SANDBOX_CONFIG" "$AIV_SANDBOX_CONFIG/journal"
chmod 700 "$AIV_SANDBOX_CONFIG" "$AIV_SANDBOX_CONFIG/journal"
(set -C; openssl rand -hex 32 > "$AIV_SANDBOX_CONFIG/plugin-token")
chmod 600 "$AIV_SANDBOX_CONFIG/plugin-token"
```

In the same terminal, create a fixed nonroot policy with mandatory Landlock and no network access. This command refuses to overwrite an existing file; check the original policy if one is present:

```bash theme={null}
(set -C; cat > "$AIV_SANDBOX_CONFIG/policy.yaml" <<'YAML'
version: 1
process:
  run_as_user: "1000"
  run_as_group: "1000"
landlock:
  compatibility: hard_requirement
filesystem_policy:
  include_workdir: true
  read_only: ["/usr", "/lib", "/lib64", "/etc", "/app"]
  read_write: ["/tmp", "/work"]
network_policies: {}
YAML
)
```

Check UID/GID, directories, Landlock support and the worker against the actual image. This example is not a compatibility guarantee for arbitrary images. Rules operate on the supplied Trace input; do not assume they can install packages or call external services over the network.

The plugin container runs with the token file owner's numeric UID/GID. The journal directory must have the same owner. That user must be able to read the policy, gateway credentials and optional TLS files. Use `0700` for configuration and journal directories and `0600` for tokens and private keys.

### 3. Install the separate plugin service

In the same terminal, replace the image, gateway, workspace and socket placeholders with the actual prepared values:

```bash theme={null}
aiv plugin install openshell \
  --image YOUR_QUALIFIED_PLUGIN_IMAGE \
  --gateway-endpoint gateway.example:30051 \
  --workload-image YOUR_APPROVED_WORKLOAD_IMAGE \
  --token-file "$AIV_SANDBOX_CONFIG/plugin-token" \
  --policy-file "$AIV_SANDBOX_CONFIG/policy.yaml" \
  --docker-socket /absolute/path/to/gateway-docker.sock \
  --journal-dir "$AIV_SANDBOX_CONFIG/journal" \
  --workspace YOUR_EXCLUSIVE_WORKSPACE \
  --state-dir "$AIV_SANDBOX_CONFIG/installation" \
  --port 8092
```

`--image` has no default. If absent locally, the CLI pulls only that explicit reference; it does not infer a repository or replace an existing installation. Add `--gateway-token-file` when the gateway needs authentication. For TLS, use `--gateway-ca-file`; supply a client certificate and private key together through `--gateway-cert-file` and `--gateway-key-file`. These credentials are separate from the plugin HTTP token.

The CLI mounts token and gateway files into the container. Token values do not enter command arguments or installation state. `installation.json` under `--state-dir` stores file paths and nonsensitive configuration; reuse that state directory for subsequent commands. The default is `~/.aivision/plugins/openshell`, or under the configuration root set by `AIVISION_CONFIG_DIR`.

When Docker runs in a VM or remote daemon, the mounted socket group inside the container may differ from the host group. The default uses the host-observed group. If an override is needed, inspect the mounted socket using the trusted plugin image, then add `--docker-socket-gid N` (`0..2147483647`, including `0`) to the install command. It sets only the supplementary group; the plugin still runs as the token-file owner and primary group. Existing and pending installations retain their original options.

#### Follow installation progress

The CLI reports six phases on **stderr**: configuration, Docker, image, saved state, container startup and readiness. Each phase shows elapsed time; a long phase reports that it is still waiting every five seconds. The image phase distinguishes a cached plugin image from a download and displays recognized Docker layer progress when available. It does not estimate an overall percentage or print unfiltered Docker output.

Configuration checks cover required inputs, file access and permissions. The plugin checks policy contents at startup. The installer only fetches the explicit plugin image; it does not install the gateway or download the workload image.

The installation has a **15-minute total budget**, including image download. Add `--timeout 30m` to the install command for a slower connection. This does not extend the separate initialization window after container startup. If a phase fails, use the printed status/logs commands with the original `--state-dir`. Preserve pending installation state and the journal instead of deleting them to bypass ownership checks.

`Running: true` with `Readiness: false` means **the container started but the provider is not ready**. The installation command can exit successfully in this state. Check the service before configuring a connection; container startup is not confirmation of provider readiness.

#### Give AgentLens the correct HTTP endpoint

By default, the CLI maps plugin container port `8091` only to **`127.0.0.1:8092`** on the Docker host. This is not a publicly reachable address. For remote or containerized AgentLens, provide a separate authenticated private-network / TLS proxy or tunnel route.

* Plugin to gateway: check that `gateway.example:30051` is reachable **inside the plugin container**.
* AgentLens to plugin: check that the HTTP(S) endpoint you will hand over is reachable from the **AgentLens service network**.
* `127.0.0.1` inside the AgentLens container points to that container, not to the plugin on the Docker host.

### 4. Check the service, then configure the Space connection

```bash theme={null}
aiv plugin status openshell --state-dir "$AIV_SANDBOX_CONFIG/installation"
aiv plugin status openshell --state-dir "$AIV_SANDBOX_CONFIG/installation" --format json
aiv plugin logs openshell --state-dir "$AIV_SANDBOX_CONFIG/installation" -n 100
```

Check installation, running state, authenticated readiness, draining state and the active / cleanup-pending lease count separately. An existing or running container does not establish that all checks are complete.

Use your team's private credential handover process to give a Space administrator the reachable plugin HTTP(S) endpoint, plugin HTTP token and approved workload image. Follow [Run custom rules in a sandbox](https://aivision.mintlify.site/en/guides/sandbox.md) to add the connection, check readiness, save the Space default and run a trial.

First execute a real rule using approved synthetic input, check the metrics, then independently verify workload cleanup. Readiness does not create a sandbox; an HTTP 200 or a screenshot cannot replace execution and cleanup acceptance. Record the actual image, architecture, gateway, policy and daemon combination before using it for team tasks.

With additional reverse proxies or application servers, allow at least **630 seconds** for `/api/v1/spaces/{spaceId}/diagnose/diagnosers/rule/trial`. The built-in nginx uses 630 seconds for this route, while the backend HTTP phase budget is 600 seconds. Neither extends the execution limit for an individual rule.

### Safe removal and upgrades

Use the original state directory:

```bash theme={null}
aiv plugin remove openshell --state-dir "$AIV_SANDBOX_CONFIG/installation"
```

Removal first authenticates and drains the service, stopping admission of new leases. The CLI removes its owned container only after active and cleanup-pending leases reach zero, container identity and process generation remain unchanged, and the service shuts down cleanly.

* **Leases remain:** the service stays draining. Wait for execution and cleanup, check status, then retry removal.
* **Service stopped, unhealthy or restarted during drain:** inspect the original container and operator configuration. Restore the owned service and let it reconcile cleanup from the durable journal, then repeat the full removal process.
* **Cleanup cannot be verified:** check the gateway's actual Docker daemon, socket and resource identities. Preserve journals and leases; do not delete records, ownership labels or installation state to bypass checks.

Removal preserves the gateway, lease journal, token and policy files. There is no force-purge option. To upgrade an image, drain and remove safely, then reinstall with the preserved journal. Use the same sequence to rotate the plugin token, then update each Space connection's write-only token and check readiness again.

In a new terminal, first set `AIV_SANDBOX_CONFIG` to the original configuration directory and reuse the same `--state-dir`. Deleting a connection in the UI does not uninstall the service; uninstalling the service does not remove its Space connection references.

### Troubleshoot installation and cleanup

| Symptom | Check and next step |
| - | - |
| Image pull fails / worker is missing | Check the exact image reference, access, target architecture and `/app/src/agentlens-rule-worker`. An ordinary or older AgentLens image does not establish plugin compatibility. |
| Service runs but is not ready | Read logs using the original state directory. Check plugin-to-gateway networking, gateway authentication and TLS files. |
| UI authentication fails | Check the plugin HTTP endpoint and HTTP token. Do not enter the gateway gRPC endpoint or gateway token. |
| UI cannot reach the service | Check the supplied private route from the AgentLens network. The CLI binds only to the Docker host's loopback address. |
| Rule reports network or permission errors | Check the fixed nonroot / Landlock / no-network policy and workload image. Do not loosen the policy to conceal incompatible execution dependencies. |
| `sandbox_cleanup_pending` / removal refused | Preserve the durable journal. Check same-daemon verification, workload identity and restart recovery. Pending leases continue to consume capacity. |

For source builds and lifecycle boundaries, see the [product operator guide](https://github.com/ob-labs/ai-vision-ob/blob/fe4105a8b8460f02d772328fee45f727a78be09d/docs/deployment/en/sandbox-plugins.md). Only the OpenShell Docker provider described here is currently supported. E2B, Runloop, CubeSandbox and Kubernetes plugin orchestration are not provided.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.