#Base policies

A base policy is anything with predict(obs, instruction) that returns one action or a chunk of actions; the benchmark decides what obs contains and what an action row means (x_harness/policies/base.py). Policy code never calls the policy: it returns {"control": "policy", "instruction": ..., "steps": n} and the benchmark lets the policy drive.

python
import x_harness as xh

xh.make_benchmark("mock")                               # built-in mock policy
xh.make_benchmark("mock", policy=None)                  # tools & primitives only
xh.make_benchmark("mock", policy=my_function)           # fn(obs, instruction)
xh.make_benchmark("mock", policy="http://127.0.0.1:8000")   # HTTP POST /act
xh.make_benchmark("libero", policy="ws://gpu-node:8000")    # simulator server URL

#The paper's checkpoints

xh.POLICY_CATALOG lists the 15 public checkpoints the paper used, as data: name, family, the benchmarks it runs on, its role. None ships here, and neither does inference code: serve a checkpoint with its own repository and point XHARNESS_POLICY_URL at the server.

CheckpointBenchmarks
MME-VLA (three variants: memory, target-marked sub-goal, language-only sub-goal)RoboMME
pi0.5 fine-tunes (six: RoboMME, LIBERO, RoboCasa, RoboTwin, RoboDojo, VLABench)one per benchmark
pi0 (three public fine-tunes, counted as one)SimplerEnv, VLABench
RLDX-1, Xiaomi-Robotics-1 (XR-1)RoboCasa365
DM0.5, WALL-OSS-1.0-liteRoboDojo
Awomo-0.5IRoboCasa365, RoboDojo

#Transports (x_harness/policies/transports.py)

TransportProtocolNeeds
OpenPIWebSocketTransport(url)OpenPI websocket: msgpack with numpy arrays; the server sends its metadata first, then answers one observation with {"actions": (N, D)}; optional acknowledged reset(seed)the ws extra
HTTPPolicyTransport(url)POST /act {"task", "state", "images"} -> {"actions"}; GET /health; POST /resetnothing
serve_policy_http(policy, port=)serves any Python policy over that HTTP protocolnothing

xharness serve-policy --policy mock --port 8000 starts the HTTP server from the command line (for custom Python policies, call serve_policy_http(my_policy, port=8000) in Python).

Every transport fault raises InfrastructureError. A wrong checkpoint behind the right address is the failure to guard against:

  • RoboMME WebSocket handshake (x_harness/benchmarks/robomme/primitives.py): On connect, VLAClient verifies the server's initial metadata dict before sending any action and raises InfrastructureError unless policy_type == "mme_vla_suite", symbolic_subgoals is True, streaming_history_buffer is False, seeded_reset is True, numerics matches expected_numerics(os.environ.get("XHARNESS_XLA_AUTOTUNE")) ("unpinned" when unset), and checkpoint ends in symbolic-grounded-subgoal/79999, then resets the policy with seed 7.
  • RoboCasa365 & RoboTwin 2.0 HTTP servers (vla_server.py): Both packages ship a LeRobot -backed POST /act server (python -m x_harness.benchmarks.{robocasa,robotwin}.vla_server --checkpoint <ckpt> --tokenizer <tok> --port 8000; default --port 0 binds an ephemeral port, optional --ready-file <path> writes {port, pid}).
  • Per-benchmark request schemas: Documented at the top of each benchmark's primitives.py (and simpler/vla.py for SimplerEnv's {"task", "eef_pos", "image"} payload).

#Models (x_harness/harness/vlm.py)

python
# Provider: "openai", "anthropic", "gemini", "vertex", "local", or "auto"
vlm = xh.make_vlm("anthropic", model="<model id>")
reply = vlm.generate(["Describe the scene.", image], system="...", effort="high")
reply.text, reply.input_tokens, reply.output_tokens
ProviderEndpointConfiguration
openaiOpenAI Responses APIOPENAI_API_KEY, OPENAI_BASE_URL
localany OpenAI-compatible chat server (vLLM, SGLang, Ollama)OPENAI_BASE_URL (default http://127.0.0.1:8000/v1)
anthropicAnthropic Messages APIANTHROPIC_API_KEY
geminiGemini APIGEMINI_API_KEY
vertexGemini on Vertex AIGOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION, the vertex extra

No model id is built in: pass model= or set XHARNESS_VLM_MODEL. Set a default reasoning/thinking effort with effort= (CLI --vlm-effort, or XHARNESS_VLM_EFFORT: low / medium / high; OpenAI also accepts none, xhigh, max). PAPER_VLMS lists the paper's models by name. The clients use the standard library's HTTP only.

  • xh.CachedVLM(vlm, "replies.jsonl") stores every reply under a hash of its request; a repeated request makes no call. Use it for evolution.
  • xh.ScriptedVLM([...]) answers from a script: the stand-in for a model in the tests and examples.

#Tools

#vision (x_harness/tools/vision.py)

The one perception object policy code receives:

python
# [{box: [r0, c0, r1, c1], score, label, centroid, area?, mask_box?, mask_iou?}]
vision.detect(image, "red mug")
# {"objects": [{xyz, extent, yaw_deg, major_m, minor_m, ...}], "relations"}
vision.get_scene_graph(image, depth, K, T_w2c, ["mug", "plate"])
# {"rc": (T, N, 2), "visible": (T, N)}
vision.track(frames, [[0, row, col], ...], stride=None)
# {"events", "waypoints", "n_frames"} (with end_xyz)
vision.analyze_demo_video(demo_rgb, init_rgb, init_depth, K, T_w2c)
# Relative inverse depth float32 (H, W); requires --depth
vision.depth(image)
vision.<tool>(...)   # any registered tool

Budgets: 16 calls per call of the program, 200 per episode across the five perception methods above (registered tools are not counted). A bad argument or a spent budget is the program's error; a missing or failing backend is an InfrastructureError.

#The perception server

vision.detect, get_scene_graph, track, analyze_demo_video, and depth go to a backend. For real images that is the perception server:

bash
pip install -e ".[perception]"
# Grounding DINO + SAM 2 + optional CoTracker3 & Depth Anything V2
xharness serve-perception --port 8765 --depth
export XHARNESS_PERCEPTION_URL=http://127.0.0.1:8765

Routes: health, detect, detect_masks, track, depth. The server refuses to listen beyond localhost without XHARNESS_PERCEPTION_TOKEN. CoTracker3 is not on PyPI and is optional at startup: without it, /health, /detect, /detect_masks, and /depth serve normally while /track returns HTTP 503 with an XHARNESS_COTRACKER_PATH hint until you clone CoTracker3 and set XHARNESS_COTRACKER_PATH. Model weights come from the Hugging Face cache and carry their own licenses (see THIRD_PARTY_NOTICES.md ). Paper settings: Grounding DINO tiny at threshold 0.1 (0.15 in the scene graph, at most 20 candidates), SAM 2 for one mask per box, CoTracker3 online, and Depth Anything V2 Small. The CPU test suite exercises the server's wire format, routing, and input checks using stand-in models.

ColorPerception is a stand-in backend with no model, for the mock benchmark and tests.

#Registered tools (x_harness/tools/toolbox.py)

python
@xh.register_tool(category="geometry")
def highest_point(camera):
    "World [x, y, z] of the highest pixel with known depth."
    ...

A registered tool is callable as vision.highest_point(camera) and is listed, with its signature and the first paragraph of its docstring, in the prompt (vision.describe()). Built in: world_to_pixel, pixel_to_world, color_blob_3d, table_height, triangulate_pixels, object_obb_3d, arc_waypoints, probe_offsets.

#Geometry (x_harness/tools/geometry/)

active_geometry (rays, triangulation, viewpoints, spiral insertion, hinge arcs), obb (oriented box of an object from mask and depth), inhand_geometry (pose of a held object, handover, intercept), micro_search (repairing a move that did not arrive). The pure functions are tested by their self-tests. The closed-loop helpers are generators over a small robot-handle protocol stated in geometry/__init__.py; the package ships no handle.

#Skill cards (x_harness/tools/skill_cards.py)

An accepted program may export helper functions (EXPORT_SKILLS) and a short lesson (SKILL_NOTE). A SkillCardLibrary stores them with training evidence and shows a task the cards that other tasks contributed. Cards are shown to the model as text, never imported.

#Reference implementations

NOTE

The two modules below are clean standalone reference implementations aligned with the report's methodology and verified on synthetic data. They are not the exact experiment scripts that produced the paper's numbers.

  • x_harness/tools/metric_depth.py: metric depth for a camera without a depth sensor. A monocular model gives inverse depth up to scale and shift; 1/Z = a d + b is fitted (RANSAC, then Huber-reweighted least squares) to anchors from a table plane, known robot points, and two-view triangulation (rays within 3 cm; or a search along the ray with patch correlation of at least 0.7).
  • x_harness/tools/tool_bank.py: a four-hook tool bank around frozen policy code (episode initialization, detection refinement, action expansion, per-step hook). BankedHost(host, bank) has the host's interface, so the runner and the evolution loop take it unchanged.