15 minutes · Laptop only · Zero GPU · Zero API keys
By the end of this walkthrough you will have run frozen policy code, read the program contract, watched a triggered Semi-online rescue, evolved a program under the 4-part selection gate, and chosen the right harness recipe for your own robot.

#Step 1. Install and inspect your environment (2 min)
pip install -e .
xharness wizard
xharness list
xharness doctorxharness wizard walks through benchmark preflight checks, maps your robot setup to a concrete harness recipe (policy use, code form, run-time tier), and prints ready-to-run commands (pass --write-starter my_program.py to scaffold a clean starter file, or --non-interactive in scripts). xharness list prints all 10 registered benchmarks and their status. Only mock is Verified (CPU): it is a pure-NumPy tabletop sandbox (a point gripper over a table, one calibrated RGB-D camera, and a scripted reaching policy standing in for a VLA). Everything in this guide runs on mock; xharness doctor tells you what optional packages or external simulators are needed for the other suites.
#Step 2. Base policy alone vs. frozen policy code (3 min)
xharness run --program programs/mock/button_unmask_swap/policy_alone.py
xharness run --program programs/mock/button_unmask_swap/reference.py \
--replay replay.htmlWhat is happening: in button_unmask_swap, a cube is visible on frame 0, then two identical covers hide both slots and swap positions. Success requires closing the gripper over the cover hiding the cube.
policy_alone.pydelegates blindly to the reactive base policy, which cannot remember frame 0 and solves 0 / 10.reference.pyadds ~30 lines of stateful policy code that remember the initial detection and track the swap—solving 10 / 10 with 0 test-time model calls.--replay replay.htmlexports a self-contained single-file HTML viewer (camera frames, TCP state, actions, outcomes, and Semi-online rescue markers) using only Python's standard library + NumPy. Openreplay.htmlin your browser to scrub step-by-step.
Open programs/mock/button_unmask_swap/reference.py : that single file captures the core idea of a policy harness.
Train vs. test split protection: the commands above run training seeds. Running held-out test seeds requires an explicit flag and automatically appends to an audit log (test_access.jsonl):
xharness run --program programs/mock/button_unmask_swap/reference.py \
--split test --allow-test#Step 3. Understand the 3-method contract (2 min)

Every policy program—whether hand-written or generated by a VLM—implements the exact same class (x_harness/program/contract.py ):
class Program:
def set_task(self, instruction, obs, vision): # called once at episode start
...
def get_action(self): # returns {"control": ..., ...}
...
def update_step(self, outcome, obs, vision): # called after every action
...obs:obs["cameras"]["front"]carriesrgb,depth(int16 millimetres,0= unknown),K, andT_w2c;obs["tcp"]gives gripper pose and opening.vision:vision.get_scene_graph(rgb, depth, K, T_w2c, ["red cube"])returns 3D object coordinates (xyz) in the action frame;vision.detect(image, text)returns[row0, col0, row1, col1]boxes;vision.track,vision.analyze_demo_video, andvision.depthexpose point tracking, demo-video analysis, and monocular depth when backed by the perception server.- Controls on
mock:move,gripper(+1open,-1closed),policy(runs the base policy forstepsunder yourinstruction),hold, anddone.
Try breaking it on purpose: add import os to a copy of a program and run it—ProgramHost rejects it during static auditing before a single line executes. Return {"control": "fly"}—the action contract catches it cleanly and reports program_error.
#Step 4. Watch a Semi-online rescue (2 min)
python examples/01_quickstart.pyPart 2 intentionally runs a buggy program on pick_cube that grasps too high:
- Offline tier: fails 0 / 5.
- Semi-online tier: the watchdog detects that the gripper lifted empty (
empty_jaw) and hands control to a VLM for a few observation-grounded turns—recovering to 5 / 5.
The example uses ScriptedVLM so no API key is required; pass xh.make_vlm(...) to plug in a live cloud or local model.
#Step 5. Evolve a program under the selection gate (3 min)
python examples/03_evolve_and_toolbank.pyWatch the 4-part selection gate in action across four candidate revisions:
- A candidate that solves more episodes overall—but breaks 4 previously solved training episodes—is rejected (the bound is at most 2 regressions).
- Its diff and regression report are fed back into the next round.
- A candidate that raises training successes with ≤ 2 regressions is accepted.
To run real evolution with any cloud or local OpenAI-compatible VLM:
# Or OPENAI_API_KEY, GEMINI_API_KEY, or OPENAI_BASE_URL for local vLLM
export ANTHROPIC_API_KEY=...
xharness evolve --benchmark mock --task pick_cube \
--vlm-model <model-id> --vlm-effort high --cache replies.jsonl \
--out programs/mock/pick_cube/<model>.py--cache replies.jsonl hashes every prompt and caches replies locally, making interrupted runs free to resume.
#Step 6. Which harness recipe fits your robot?
xh.recommend_tier(...) and xharness wizard
Strong VLA & in-distribution?
Yes: Run the minimal policy_alone wrapper to preserve peak trained accuracy (97.2% on LIBERO Std).
Shift / memory: Write stateful policy code delegating 2D-marked sub-goals to the VLA.
No VLA: Use RGB-D perception tools + 3D motion primitives.
Match structure to your VLM
Frontier VLM (Opus / Sonnet): Keep --form freeform Python.
Lighter / local VLM (Flash / edge): Switch to a structured template (bt, coro, or rules) for +7.6 pp lift.
4–8 gated rounds on train seeds
Run EvolutionLoop under SelectionGate(max_regressions=2) on training seeds only, then freeze with SHA pinning for 0 test-time VLM calls.
Residual failures left?
No: Deploy Offline frozen code at native 16.7–25 Hz.
Yes: Enable Semi-online bounded rescue (Rescue watchdog, ≤24 turns only on physical faults).
| Your situation | Recommended starting point |
|---|---|
| Strong VLA on in-distribution tasks | Start with the policy-alone wrapper (EvolutionLoop also tests it automatically as a baseline). |
| VLA struggles on memory, multi-step logic, or shifted layouts | Add closed-loop policy code that keeps state and sends sub-goals via policy actions. |
| No VLA available for your robot | Use perception tools (vision.get_scene_graph) + 3D motion primitives (move, pick, place) with accurate depth. |
| Training episodes available (10–40 / task) | Run 4–8 gated evolution rounds (SelectionGate), then freeze for 0-overhead Offline execution. |
| Residual failures remain after evolution | Turn on the Semi-online tier (Rescue) so a VLM steps in only when a watchdog/rule trigger fires. |
| Smaller or weaker code-writing VLM | Switch --form from freeform to a structured template (rules, bt, coro, pddl, or rekep). |
You can call xh.recommend_tier(...) for the exact same decision logic in Python.
#Step 7. Connect your own simulator or robot
- Your own simulator: copy
x_harness/benchmarks/_template/(four concise files) or walk throughexamples/05_new_benchmark_demo.pyand docs/extending.md. - One of the seven supported simulators: install the simulator, launch a policy server, and check that benchmark's entry in docs/benchmarks.md#full-environment-setup. Always run one task with the policy-alone wrapper first to verify connectivity.
- A real robot: read docs/benchmarks.md#real-yam carefully before running anything. Hardware commands default to dry run for safety.
#Step 8. Three rules to keep in mind
- Never conflate infrastructure faults with policy failures. Setup, server, or simulator crashes raise
InfrastructureErrorand stop the run—never swallow them into a 0% policy score. - Keep training and test splits strictly separate. Evolve and tune only on training seeds; inspect
test_access.jsonlbefore reporting test metrics. - Treat
ProgramHostas a guardrail, not an OS sandbox. Always isolate untrusted code in a container.