edbeeching HF Staff
Port 270 AgentEscapeBench tasks to Harbor with OpenEnv integration (part 2)
49aa045 verified Download src/agentescape_port/runtime/grade.py from HuggingFaceSwarms/AgentEscapeBench: direct link, hf CLI and curl.
- Browser
- Download file 995 Bytes
-
https://huggingface.co/datasets/HuggingFaceSwarms/AgentEscapeBench/resolve/refs%2Fpr%2F2/src/agentescape_port/runtime/grade.py
- Command line
-
hf download hf://datasets/HuggingFaceSwarms/AgentEscapeBench@refs/pr/2/src/agentescape_port/runtime/grade.py
-
curl -L -o grade.py https://huggingface.co/datasets/HuggingFaceSwarms/AgentEscapeBench/resolve/refs%2Fpr%2F2/src/agentescape_port/runtime/grade.py
995 Bytes
| """Grade only Harbor-collected sidecar evidence in a fresh verifier container.""" | |
| import json | |
| from pathlib import Path | |
| expected = json.loads(Path("/tests/expected.json").read_text()) | |
| state = json.loads(Path("/evidence/final.json").read_text()) | |
| assert state["collected_from_live_service"] is True, "Missing trusted service export" | |
| assert state["scenario_sha256"] == expected["scenario_sha256"], ( | |
| "Wrong scenario evidence" | |
| ) | |
| assert state["max_actions"] == expected["max_actions"], "Wrong budget" | |
| assert type(state["won"]) is bool | |
| assert 0 <= state["action_count"] <= state["max_actions"] | |
| assert state["termination_reason"] != "infrastructure_error", ( | |
| "Infrastructure failure is not a puzzle failure" | |
| ) | |
| assert not state["won"] or state["termination_reason"] == "success" | |
| Path("/logs/verifier").mkdir(parents=True, exist_ok=True) | |
| Path("/logs/verifier/state.json").write_text(json.dumps(state, indent=2)) | |
| Path("/logs/verifier/reward.txt").write_text("1.0\n" if state["won"] else "0.0\n") | |