Skip to main content
After installing OpenShell in the target Space, custom rules can import preinstalled libraries, test generated Python, reconcile tables, validate business constraints, and evaluate retrieval ranking or numerical error. Load a complete example, inspect every metric’s reason and evidence, then use content actually recorded in your own Trace. This page applies to platforms with Integrations → Plugins → Sandbox → OpenShell. Management requires Space administrator or developer permissions; creating custom diagnosers also requires a team space. Start with Automatic installation, which asks for no images, gateway, plugin endpoint or token. The advanced section below covers an independently deployed service.

1. Install automatically and save the Space connection

  1. Switch to the target Space and open Integrations → Plugins → Sandbox → OpenShell → Install OpenShell.
  2. Read the target host and permission requirements, then choose Copy install command.
  3. Use the matching CLI that supports aiv plugin setup openshell. Run the complete copied command in a terminal on the AI Vision deployment host. Copying does not run it; do not use another host or Docker daemon.
  4. Follow the reported phases and wait for Space connection saved. Setup prepares the images, dedicated gateway, secure configuration and plugin, then saves and tests the connection through the server. No technical parameters need to be entered.
See Automatic OpenShell installation for prerequisites and recovery. If the installation catalog is unavailable, ask the deployment administrator for a compatible version/package. Do not invent image references or switch to a manual form. Closing or reloading the drawer resumes reads without rerunning installation. Service ready and Space connection saved are different states. Readiness checks authentication, protocol and provider state; it creates no workload and does not validate rule execution or cleanup. Continue with the explicit default setting and trial below.

2. Set the Space default and execution policy explicitly

After the automatic-install drawer shows Space connection saved, choose Set as Space default if needed. The server tests the connection again and confirms the binding before showing Space default set. This action preserves the current “Require sandbox execution for custom rules” setting and the frozen targets of existing Tasks.
English dark installation drawer on a 390-pixel viewport shows seven completed stages and the server-confirmed Space default

Actual Linux AMD64 VM: confirmed default and compact footer · Read-only English view · Click to enlarge

For an existing-service connection added through the advanced path, return to Sandbox, select the verified Default connection under Space execution policy, and choose Save Space default. Other execution-policy settings are also managed there separately. If every custom rule must use a sandbox, also select Require a sandbox for Custom Rule execution and save. This setting refuses local execution; it does not install the service or configure a connection. Execution fails when no usable sandbox is available.
English Sandbox page with OpenShell on the left and the Space default connection and sandbox requirement on the rightEnglish Sandbox page in dark mode showing the Space execution policy

Sandbox: provider configuration and Space execution policy · Running UI with demonstration data · Click to enlarge

3. Choose the custom rule’s execution environment

In a team space, open Diagnosers → New Diagnoser and choose the rule type. Under Execution environment, select one of the three execution-mode buttons: With Follow Space settings, the field below directly displays the Space default connection. If there is no default and the Space permits local execution, it shows Local execution. A green check inside the connection field indicates verified readiness, with hover text and an accessible status label. With Use sandbox, choose a Sandbox connection in the same area or use the Space default when no connection is explicitly selected. If a required connection is missing, the page prompts you to choose one or configure a Space default.
English custom rule execution environment with Follow Space settings, Use sandbox, Local execution and the current target and readinessEnglish custom rule execution environment in dark mode with three execution modes and the current target

Custom rule execution: three modes, the resolved target and readiness · Running UI with API demonstration data · Click to enlarge

If a selected connection is missing, disabled, unready or unreachable, execution does not automatically fall back to local. Only restricted rules can keep an optional local path under an explicit Space policy and rule mode; changing the mode does not downgrade an enhanced rule. Sandboxes are used only for custom rules. LLM evaluators call model services through model connections and do not use this sandbox execution selection. This rule-editor example’s readiness state comes from API demonstration data; it does not replace real rule execution and cleanup checks.

Confirm the enhanced Python environment

A compatible connection shows Enhanced Python · imports, files and code tests. Open Available libraries for the Python and package versions reported by this sandbox: pytest, NumPy, pandas, Pydantic, jsonschema and openpyxl, alongside the standard library. You do not enter images, install packages or select another runtime mode.
  • New rules: the editor automatically uses enhanced Python once it confirms a compatible sandbox, and saves that environment identity.
  • Existing rules: keep their restricted Python behavior until you explicitly choose Use enhanced Python, review the draft and save it. Historical Task snapshots retain their original behavior.
  • Local or incompatible targets: cannot run enhanced rules and never trigger local fallback. Choose a compatible sandbox before saving or trying the rule.
  • Plugin update required: ask your operator for matching plugin and workload versions. Increasing timeout or memory alone does not add runtime support to an old plugin.
Actual Linux AMD64 VM rule editor shows sandbox execution, 30-second budget and six library versions in Chinese

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

You still write the rule: use evaluate(trace) or evaluate(trace, context) and return each declared metric, its good / bad verdict, reason and JSON evidence. Enhanced rules support ordinary imports, helper functions and classes. Use context for materials and reference tests; confirm observed field expressions with View Trace Structure. New automatic installations recommend 1 CPU, 1 GiB and 30 seconds. Existing connections are unchanged. With management permission and a compatible environment whose limits are too low, choose Apply recommended limits. This raises only insufficient values, preserves higher limits and checks readiness again. Read Effective execution budget in the summary, separately from Connection limit. The read-only runtime API reports the smaller of the enhanced service ceiling and the connection limit: a connection capped at 5 seconds still cannot run for 30 seconds.

Load 7 complete examples, from starter checks to advanced evaluation

Expand Load an example and choose from Starter examples or Advanced examples. Each includes matching metrics, complete evaluation code, reference materials, expected values and synthetic test input. Loading replaces these draft contents and clears previous Trial results, so start with a new rule. Inspect each metric’s reason and evidence, then deliberately change an input to confirm that the rule detects an error. The example.* fields are teaching conventions, not fields automatically collected from your Agent. Examples need neither network access nor package installation. Reference materials are inputs to the evaluator. If they are malformed or internally inconsistent, fix them and rerun; an evaluator execution error is not an Agent-quality verdict.
The reference schema.json requires a non-empty answer and at least one unique citation ID, and forbids extra fields. Change input citations to []: expect schema_valid: bad and a field path. A valid structure does not establish a correct answer.Metrics loaded: schema_valid.
Rule code
Synthetic test input
schema.json
Compare both a pandas total from sales.csv and the value openpyxl reads from reference.xlsx:B2 against reported input; both references are 42. Change only example.total to 41: csv_total should become bad while xlsx_match remains good. Loading includes the binary workbook; no Base64 copying is needed.Metrics loaded: csv_total, xlsx_match.
Rule code
Synthetic test input
sales.csv
reference.xlsx: This binary file loads with the example. The source workbook contains B2 = 42; you do not construct it manually.
Candidate source provides normalize_tags through a temporary candidate module. Reference tests check case folding, deduplication, first-seen order, input preservation, empty values and invalid input. Replace .casefold() with .lower() in the candidate: the Unicode case should fail. The file uses pytest parameterization and exception assertions rather than checking only whether a process starts.Metrics loaded: reference_tests.
Rule code
Synthetic test input
tests/test_candidate.py
orders.csv contains 3 orders and refunds.csv allows multiple refunds per order. Aggregate refunds before joining to avoid counting orders twice, then reconcile integer-cent amounts by region. Expected East is 2100, West is 2500 and net revenue is 4600 cents. Change only net_revenue_cents to see a passing regional metric and a failing net-revenue metric.Metrics loaded: regional_totals, net_revenue.
Rule code
Synthetic test input
orders.csv
refunds.csv
The Pydantic model checks strict types, extra fields and cross-field rules: refunds cannot exceed an order total; rejected decisions require zero refund; approved decisions require a positive refund; reasons cannot be blank. Set refund_cents to 11000 for the 10000-cent order: expect business_valid: bad with constraint locations and reasons.Metrics loaded: business_valid.
Rule code
Synthetic test input
Supply relevant document IDs, k and thresholds through Expected value (JSON). Change retrieved order to ["doc-x", "doc-a", "doc-b"]: recall and citation coverage can still pass while ranking quality fails. This compares supplied relevance labels and citation IDs. It does not establish answer faithfulness or call an embedding or judge model.Metrics loaded: retrieval_recall, ranking_quality, citation_coverage.
Rule code
Synthetic test input
Expected value (JSON)
Supply the reference vector, absolute/relative tolerances and RMSE ceiling through Expected value (JSON). NumPy checks both each point and aggregate drift. Change the first prediction from 10.01 to 10.2: inspect the failing index, MAE and RMSE. Missing, boolean, non-numeric or mismatched-length input cannot pass.Metrics loaded: tolerance, error_budget.
Rule code
Synthetic test input
Expected value (JSON)

Adapt an example to an actual Trace

Use View Trace Structure to locate actual output or candidate source, then replace the example.* read locations in the code. Do not assume that output belongs to the first Span. Replace reference materials, relevance labels or error thresholds and keep every returned metric aligned with its declaration. Select the actual Trace, rerun the Trial, inspect each reason and evidence, then save. Missing source, files or tool calls are not reconstructed. Reference tests check ordinary correctness against your requirements; they do not promise protection against deliberately cheating candidates. A business model checks rule consistency, not actual business authorization. Relevance labels, citation IDs and numerical error checks are not semantic fact-checking.
These Chinese UI captures show the new advanced-example catalog with descriptions and libraries. Reordering retrieval results produces nDCG of about 0.693426, below the 0.9 threshold, while citation coverage remains 1. Generated code passes all 9 reference tests with 0 skipped.
Chinese UI: choose an advanced example by purpose and installed library

Chinese UI: choose an advanced example by purpose and installed library

Chinese UI: ranking fails independently while citation coverage passes

Chinese UI: ranking fails independently while citation coverage passes

Chinese UI: 9 reference tests passed, 0 failed and 0 skipped

Chinese UI: 9 reference tests passed, 0 failed and 0 skipped

The results use an actual OpenShell provider in a prepared macOS ARM64 / OrbStack Linux ARM64 local environment with explicitly synthetic input. These views show the selected controls and two result types; they do not establish real Agent Trace ingestion, another architecture, released images or a cold installation.
The result UI below is Chinese. These captures come from the earlier macOS ARM64 / OrbStack Linux ARM64 local source-QA exercise: a two-test addition function and separate JSON/CSV/XLSX comparisons. They show the execution and evidence presentation of those earlier examples, not verification of these 7 new templates. Inputs are synthetic; the images do not establish actual Agent Trace ingestion or another platform’s acceptance.
Earlier passing reference test: 2 cases

Earlier passing reference test: 2 cases

Earlier failing reference test: 2 assertion differences

Earlier failing reference test: 2 assertion differences

Earlier JSON-schema comparison

Earlier JSON-schema comparison

Earlier CSV-total comparison

Earlier CSV-total comparison

Earlier XLSX-cell comparison

Earlier XLSX-cell comparison

Add your own tests and data materials

Expand Tests and data materials, choose small files or add a text file. Edit reference tests, JSON, CSV and relative paths; select XLSX files to retain their binary contents. You can also enter an optional Expected value (JSON) and read the parsed value through context.expected.
Send expected values as the JSON string materials.expected_json. For example:
The service preserves this text and counts its original UTF-8 bytes, then parses it for context.expected. Legacy API materials.expected objects remain accepted, but cannot appear together with expected_json. Editing and saving an old rule converts it to the new field.
Code, material, expected-value, target or environment edits require another trial. An old passing result cannot validate the changed draft. Formal Tasks keep the same material and environment identity instead of silently selecting a different runtime later.

Check the complete execution-input budget

Before running, inspect the editor’s input usage and effective budget. Expand it for exact request and worker-input byte counts. Code, the complete Trace (including original payload and attributes), materials, expected JSON and serialization overhead share this budget. The separate 512 KiB material limit still applies. New installations default to 8 MiB (8,388,608 bytes), with a 16 MiB operator hard ceiling. The actual budget also depends on the workload image’s qualified capacity. An old image without valid immutable input-capacity metadata retains the 2 MiB compatibility limit; editing a connection does not upgrade that image. The platform checks both the complete request and normalized worker input before reserving a lease. It never silently truncates the Trace. Recheck after code, material, expected-value or sample edits. Oversize input disables Run; sandbox_input_limit reports the stage, actual bytes and allowed bytes. Reduce the meaningful evaluation input or ask your operator to update the matching components. Do not discard arbitrary Spans, bypass completeness checks or raise the gRPC decoder ceiling to hide a total-budget failure. Old plugins without preflight support require an update.

4. Try the rule on a reviewed Trace

  1. Follow the custom rule example to confirm the actual field expressions in evaluate(trace), declared metrics and return format.
  2. Confirm the execution mode and resolved target. Under Test and Validate, choose a Trace you have checked manually and select Run Diagnosis.
  3. Compare each metric’s verdict, reason and evidence with the Trace. Resolve execution or cleanup failures first; they do not mean that the Agent being checked has poor quality.
  4. Ask your operator to confirm that the workload was cleaned up. Neither Readiness verified nor a rule’s exit code proves cleanup.
  5. Run another trial after changing the rule, execution environment, connection or sample, then save the diagnoser. Add it to a diagnosis task for a formal run.
Trial evidence can show passed, failed, skipped and total cases, duration, failing paths, expected/actual values and bounded output. Candidate syntax errors, imports outside the provided environment and assertion mismatches produce bad. Invalid reference tests, environment mismatch and runtime faults are execution errors. With no observed candidate failure, zero tests or incomplete skip/xfail verification are also execution errors, never passing verification. Restricted rules retain the original 5-second default service ceiling. Enhanced rules default to a 30-second service ceiling; the actual limit is the smaller service/connection value. The trial HTTP phase budget is 600 seconds for creation, execution and cleanup; it does not allow a single rule to run for 600 seconds. New tasks freeze their resolved execution target at creation. Changing the Space default does not reroute existing tasks; historical tasks retain their recorded route. If the connection endpoint, image or resource profile changes, old tasks may report sandbox_identity_changed. Check the configuration and create a new task rather than expecting the old one to switch connections.

Inspect the individual Record after a formal Task

Open the Task in execution history, check selected/scanned samples, valid judgments, skips and failures, then open the corresponding diagnosis Record. Compare each metric, reason and evidence. A Task marked succeeded does not establish that every rule executed successfully or that every metric is good. Resolve execution failures, cleanup failures and incomplete input before interpreting Agent quality. For programmatic acceptance, use existing authorization to read that Record’s execution_status and execution evidence, including backend=sandbox and provider=openshell. Rules requiring a complete Trace should also check source_complete and projection_failed. Execution status, metric good / bad and human-review status are separate facts.
Actual OpenShell Record shows the reason and answer evidence after checking seven complete Spans; human review remains pending

One persisted Record from the actual Linux AMD64 VM · Chinese interface and synthetic input · Click to enlarge

This example uses an isolated nested Ubuntu 24.04 Linux AMD64 VM, prepared exact-digest image caches and a synthetic Trace. Result API and independent database reads confirmed the same successful OpenShell Record; cleanup was checked separately. This does not qualify an unprepared cold installation, released images, installation on the parent host or another architecture.

Advanced: connect an existing OpenShell service

Use this only for an independently deployed plugin service. The recommended automatic flow does not require these fields. Switch to the target Space and open Integrations → Plugins → Sandbox → OpenShell → Add connection. Obtain these values from your operator:
English OpenShell connection form with plugin HTTP endpoint, workload image, token and resource limitsEnglish OpenShell connection form in dark mode with no token displayed

Add an OpenShell connection using the operator's endpoint and image · Example values; token omitted in this capture, required on create · Click to enlarge

Save, select Check readiness, and confirm that the connection shows Readiness verified. Saving a connection does not check it or make it the Space default. The readiness check validates authentication, protocol and provider state. It does not create a workload, run rule code or verify resource cleanup. The token is write-only and is not shown when editing. Leave it blank during an ordinary edit to keep the saved value. When changing the Plugin HTTP endpoint, enter the token again; leaving it blank is not allowed for an endpoint change. Use only an endpoint your operator confirms is trusted. Check readiness again after replacing credentials.
English OpenShell page with a Space connection, Check readiness button and collapsed plugin deployment instructionsEnglish OpenShell connection management page in dark mode

OpenShell: manage this Space's connections; deployment help is initially collapsed · Running UI with demonstration data · Click to enlarge

Troubleshooting

Deleting a saved connection does not uninstall the plugin service. First clear its default binding, update diagnosers that still reference it, and finish the relevant pending or running tasks and their cleanup. Then delete the connection; completed task snapshots do not need rewriting. For service removal, see OpenShell operations.