diff --git a/.agents/skill-library/evaluation/label-benchmark/SKILL.md b/.agents/skill-library/evaluation/label-benchmark/SKILL.md index 9b96b0f85..2488999ea 100644 --- a/.agents/skill-library/evaluation/label-benchmark/SKILL.md +++ b/.agents/skill-library/evaluation/label-benchmark/SKILL.md @@ -128,6 +128,7 @@ Labels cover the tasks `units` lists for each dataset with every option at its d value lists (`--bench-option NAME=VALUE`, a split) go through the steps when the user asks; else the report names those values. Two datasets with one task file (the same `path` and `sha256`) and the same assembled `policy` text, compared exactly (step 2): take one through the steps and write its `tasks` rules for both. Either differs (a workflow variant's policy): both go through. +Every reuse, this one and those below, also needs the same `benchmark` and `setup` (step 2), compared exactly: either differs, both go through. Datasets with the same task ids, questions and expected answers, differing only in the context around them (a longer history), are the same tasks at another size: take the smallest through the steps and write its `tasks` rules for each. The same tasks in another language: take every language through the steps; a label stands where all agree, for each. @@ -155,6 +156,14 @@ but those in `skip`: the axes step 1 gave it, `[]` or left out for none. A line ``` - `request`: the task's input as the agent or the simulated person gets it, an object or a text. Required. +- `benchmark`, `setup`: never written by hand, the same for every task of a dataset `D` at `REF`: + ```bash + PYTHONPATH=REPO/app python3 SKILL/scripts/catalogue_fields.py REF D + ``` + `benchmark` is what a task is, the summary's first clause, never how it is scored. `setup` holds `required`, every + port the benchmark declares, and `available`, what the agent may consult: `web` (`on`, `off` or `unknown`, always + there), the search port, the benchmark's MCP servers, the dataset's environment. Available is not needed: no label + follows from it alone. - `checks`: what the benchmark grades, and nothing else: where a task names the checks that count (a `reward_basis`, a weight of zero), leave the others out. An empty value is evidence and stays: no action expected, an empty list. - `policy`: the rules the agent actually receives for this dataset, whole, as the benchmark's driver assembles diff --git a/.agents/skill-library/evaluation/label-benchmark/scripts/catalogue_fields.py b/.agents/skill-library/evaluation/label-benchmark/scripts/catalogue_fields.py new file mode 100644 index 000000000..4e5779399 --- /dev/null +++ b/.agents/skill-library/evaluation/label-benchmark/scripts/catalogue_fields.py @@ -0,0 +1,78 @@ +"""The two state fields every task of a dataset gets from the catalogue alone: `benchmark` and `setup`. + + PYTHONPATH=REPO/app python3 SKILL/scripts/catalogue_fields.py REF DATASET + +Reads the benchmark at `REF` as a run reads it (`definitions.get`, a user's entry included). No wording per benchmark. + +`benchmark`: what a task is, never how it is answered or scored: the first clause of the definition's `summary`, up to +its first `;` or `:`. Each task's own `checks` say how it is scored. + +`setup`: declared facts only. +- `version`: the version labelled, when the entry holds versions. +- `required`: every port the benchmark declares, search included: what any agent must offer to be given the task, + each with the standard's summary. Left out when the benchmark needs none. +- `available`: what the agent may consult. Availability is not need: nothing here says a checked fact depends on it. + - `web`: always present. `off` under `agent_options.web_tools: off`; `on` when the dataset's environment declares + `network.access: public`; else `unknown`. The search port alone says nothing of the web: it may serve a bounded + collection. + - `search`: the search port's summary, when the benchmark needs it (under `required` too). + - `tools`: the MCP servers the benchmark serves, each with its summary. + - `environment`: the summary of the dataset's environment. +""" +import json +import re +import sys + +SEARCH = "agent.search/v1" + + +def task_summary(summary): + """The summary's first clause: what a task is. The rest says how it is answered and scored.""" + return re.split(r"[;:]", summary.strip(), maxsplit=1)[0].strip().rstrip(".") + "." + + +def fields(definition, dataset, ports): + """{"benchmark": ..., "setup": {...}} for `dataset` of a resolved benchmark `definition`; `ports` the standard's.""" + needs = definition.get("needs") or [] + row = next((d for d in definition.get("datasets") or [] if d.get("id") == dataset), {}) + env = (definition.get("environments") or {}).get(row.get("environment") or "", {}) + if (definition.get("agent_options") or {}).get("web_tools") == "off": + web = "off" + elif (env.get("network") or {}).get("access") == "public": + web = "on" + else: + web = "unknown" + available = {"web": web} + if SEARCH in needs and SEARCH in ports: + available["search"] = ports[SEARCH]["summary"] + tools = {k: v["summary"] for k, v in (definition.get("mcp_servers") or {}).items() + if isinstance(v, dict) and v.get("summary")} + if tools: + available["tools"] = tools + if env.get("summary"): + available["environment"] = env["summary"] + setup = {} + if "@" in str(definition.get("_ref") or ""): + setup["version"] = definition["_version"] + required = {p: ports[p]["summary"] for p in needs if p in ports} + if required: + setup["required"] = required + setup["available"] = available + return {"benchmark": task_summary(definition["summary"]), "setup": setup} + + +def main(argv): + from nullius.standard.contract import definitions, ports + if len(argv) != 2: + sys.exit("usage: catalogue_fields.py REF DATASET") + ref, dataset = argv + definition = definitions.get("benchmark", ref) + if definition is None: + sys.exit(f"no benchmark {ref}") + if dataset not in [d.get("id") for d in definition.get("datasets") or []]: + sys.exit(f"no dataset {dataset} in {ref}") + print(json.dumps(fields(definition, dataset, ports.PORTS), ensure_ascii=False)) + + +if __name__ == "__main__": + main(sys.argv[1:]) diff --git a/.agents/skill-library/evaluation/label-benchmark/scripts/decide.py b/.agents/skill-library/evaluation/label-benchmark/scripts/decide.py index 7ead2b854..6b8add23f 100644 --- a/.agents/skill-library/evaluation/label-benchmark/scripts/decide.py +++ b/.agents/skill-library/evaluation/label-benchmark/scripts/decide.py @@ -64,7 +64,7 @@ KEY_VAR = "NULLIUS_LABEL_OPENROUTER_KEY" DENY = {"data_collection": "deny"} YES_ABOVE, NO_BELOW = 0.7, 0.3 # TypeSafe's starting thresholds for a noul -STATE = ("request", "purpose", "notes", "ticket", "given", "checks", "policy") # the state's fields; `request` is required +STATE = ("request", "benchmark", "setup", "purpose", "notes", "ticket", "given", "checks", "policy") # the state's fields; `request` is required MODELS = ("typesafe/jev-1.14", "perplexity/pplx-decider-v1.2", "liquid/d1.3-ultra") # three makers, when none is named MODEL = re.compile(r"~?[A-Za-z0-9][A-Za-z0-9._-]*/[A-Za-z0-9][A-Za-z0-9._:-]*") TIMEOUT = 120 diff --git a/app/nullius/catalogue/benchmarks/osworld2/standard.json b/app/nullius/catalogue/benchmarks/osworld2/standard.json index 1676a4d1b..c3e2d2057 100644 --- a/app/nullius/catalogue/benchmarks/osworld2/standard.json +++ b/app/nullius/catalogue/benchmarks/osworld2/standard.json @@ -2,7 +2,7 @@ "schema": "nullius.benchmark/v1", "key": "osworld2", "label": "OSWorld2", - "summary": "Long multi-app tasks on an Ubuntu desktop VM, scored 0 to 1 by each task's own check.", + "summary": "Long multi-app tasks on an Ubuntu desktop VM; scored 0 to 1 by each task's own check.", "family": "agent", "gated": true, "needs": [ diff --git a/app/tests/test_label_benchmark_skill.py b/app/tests/test_label_benchmark_skill.py index ec2458e52..f59655bc4 100644 --- a/app/tests/test_label_benchmark_skill.py +++ b/app/tests/test_label_benchmark_skill.py @@ -16,7 +16,7 @@ from unittest import mock from nullius.leaderboard import labels -from nullius.standard.contract import definitions +from nullius.standard.contract import definitions, ports SKILL = Path(__file__).resolve().parents[2] / ".agents/skills/label-benchmark" SCRIPT = SKILL / "scripts/decide.py" @@ -324,6 +324,30 @@ def test_a_line_that_cannot_be_asked_is_refused(self): self.assertEqual(Fake.seen[0][2]["state"], {"request": "TASK TEXT", "checks": {"actions": []}, "notes": [], "policy": {"refunds": ["POLICY"]}, "given": {"tools": ["GIVEN"]}}) + def test_the_catalogue_gives_benchmark_and_setup_and_both_are_sent(self): + spec = importlib.util.spec_from_file_location("label_catalogue_fields", SKILL / "scripts/catalogue_fields.py") + fields = importlib.util.module_from_spec(spec) + spec.loader.exec_module(fields) + def printed(ref, dataset): + out = io.StringIO() + with contextlib.redirect_stdout(out): + fields.main([ref, dataset]) + return json.loads(out.getvalue()) + task, search = "agent.task/v1", "agent.search/v1" + browse = printed("browsecomp", "test") # search, and a public network + self.assertEqual((list(browse["setup"]["required"]), browse["setup"]["available"]["web"]), ([task, search], "on")) + self.assertIn("search", browse["setup"]["available"]) + alone = {"summary": "S.", "needs": [task, search], "datasets": [{"id": "d"}]} # search alone: a collection, maybe + self.assertEqual(fields.fields(alone, "d", ports.PORTS)["setup"]["available"]["web"], "unknown") + self.assertEqual(printed("osworld2", "offline36")["benchmark"], # what a task is, never how it is scored + "Long multi-app tasks on an Ubuntu desktop VM.") + got = printed("simpleqa", "simpleqa") # web tools off: closed book + self.assertEqual(got["setup"], {"required": {task: mock.ANY}, "available": {"web": "off"}}) + self.write(["Execution"], **got) + code, lines, _ = self.run_script(JEV, YES, argv=["--dry-run"], key="") + self.assertEqual((code, lines[0]["body"]["state"]["setup"]["available"]), (script.OK, {"web": "off"})) + self.assertEqual(lines[0]["body"]["state"]["benchmark"], got["benchmark"]) + def lines(self, *tasks): self.tasks.write_text("".join(json.dumps({"dataset": "d", "task": str(n), "state": {"request": "TASK TEXT"}, **t}) + "\n" for n, t in enumerate(tasks)))