The first exam for code agents in the physical world: frozen robot tasks from many benchmark suites, each answered with a program and verified in a separate sandbox. Runs on Harbor.
Python ai-agentsbenchmarkcoding-agentsembodied-aievaluationharborllm-agentsrobot-learningroboticssimulation
"""Standard-mode verifier: reads what the sim service (which the agent could not touch) wrote: /data/final.json (the
LIVE episode's result and the crash-recovery fields), /data/trajectory.npz, /data/live.mp4. The trial is graded by its
live episode (no grading replay): success = the live episode's success (YAMLab's
success check latched every stage at a control step of the episode the agent ran) and no infrastructure failure. Numeric-only reward.json; a reward is written whatever final.json holds.
infra_error = 1 (no verdict on the agent, PROTOCOL §2.6): final.json is missing (the service never came up, or its
container was gone when the collect hook ran), unreadable, or not finalized (the collect hook did not finish); or the
service or the hook reported one: a give-up after crashes between calls (`sim_crashed`), a failed resume, the frozen
instance not rebuilt at the episode's start (`instance_mismatch`, before the agent was served), the episode never ended
for the hook, no record of the live episode (episode.json). A give-up after crashes inside the agent's calls
(`sim_crashed_on_call`) and a simulator error raised during the agent's calls (reason "error", `sim_error`) stay the
agent's 0, even after a success the episode had reached (PROTOCOL §4). The video never decides anything (`video_rendered`)."""
import json, os, shutil, traceback
LOG = os.environ.get("RCB_VERIFIER_LOG_DIR", "/logs/verifier"); DATA = os.environ.get("RCB_DATA", "/data")
os.makedirs(LOG, exist_ok=True)
def write(ok, out):
open(f"{LOG}/reward.txt", "w").write("1\n" if ok else "0\n"); json.dump(out, open(f"{LOG}/reward.json", "w")); print(out)
NONE = {"success": 0, "live_success": 0, "graded_by_live": 1, "replays": 0, "finalized": 0, "sim_error": 0} # no verdict could be read
p = f"{DATA}/final.json"
if not os.path.exists(p):
write(False, {**NONE, "missing_log": 1, "grader_error": 0, "infra_error": 1}); raise SystemExit
try:
d = json.load(open(p))
if not isinstance(d, dict): raise ValueError(f"final.json holds a {type(d).__name__}, not an object")
except Exception: # noqa: BLE001 -- a truncated or corrupt final.json is the infrastructure's failure, not the agent's
traceback.print_exc()
write(False, {**NONE, "missing_log": 0, "grader_error": 1, "infra_error": 1}); raise SystemExit
for f in ("live.mp4", "live.last.png", "trajectory.npz", "episode.jsonl"):
try:
if os.path.exists(f"{DATA}/{f}"): shutil.copy(f"{DATA}/{f}", f"{LOG}/{f}")
except OSError:
traceback.print_exc() # the evidence never decides the verdict
def num(k):
try: return float(d.get(k) or 0)
except (TypeError, ValueError): return 0.0
unfinished = not d.get("finalized") # the collect hook never completed final.json
infra = bool(d.get("infra_error")) or unfinished
sim_error = d.get("reason") == "error" # PROTOCOL §4: a simulator error is the agent's 0, whatever success came before
ok = bool(d.get("success")) and not infra and not sim_error
write(ok, {"success": int(ok), "live_success": int(bool(d.get("success"))), "graded_by_live": 1, "replays": 0,
"finalized": int(not unfinished), "missing_log": 0, "n_actions": int(num("n_actions")), "sim_steps": int(num("control_steps")),
"physics_steps": int(num("physics_steps")), "steps": int(num("steps")), "elapsed_s": num("elapsed_s"),
"object_fell": int(d.get("reason") == "object_fell"), "video_rendered": int(bool(d.get("video"))), "video_frames": int(num("video_frames")),
"sim_error": int(sim_error), # a simulator error during the agent's calls: the agent's 0
"instance_mismatch": int(bool(d.get("instance_mismatch"))), "instance_exact": int(bool(d.get("instance_exact"))),
"grader_error": 0,
# an infrastructure failure, not the agent's (PROTOCOL §2.6): see the module docstring
"infra_error": int(infra), "gave_up": int(bool(d.get("gave_up"))),
"sim_crashed_on_call": int(d.get("reason") == "sim_crashed_on_call"),
"sim_startups": int(num("sim_startups")), "resumes": int(num("resumes")),
"resume_state_mismatch": int(num("resume_state_mismatch")), "resume_max_tcp_dev_m": num("resume_max_tcp_dev_m"),
"resume_max_joint_dev": num("resume_max_joint_dev")})