Datasets:

Modalities:
Text
Languages:
English
Size:
< 1K
ArXiv:
Libraries:
Datasets
Harbor
License:
lewtun HF Staff commited on
Commit
8eb408e
·
verified ·
1 Parent(s): 6397897

One task per slot (agg-pPP-nNN-sKK) whose instruction states its number; no resources/ (Flock's selector gives each agent its own task) (part 7)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. tasks/agg-p12-n16-s01/tests/test.sh +89 -0
  2. tasks/agg-p12-n16-s02/instruction.md +21 -0
  3. tasks/agg-p12-n16-s02/solution/solve.sh +5 -0
  4. tasks/agg-p12-n16-s02/task.toml +27 -0
  5. tasks/agg-p12-n16-s02/tests/expected.json +1 -0
  6. tasks/agg-p12-n16-s02/tests/test.sh +89 -0
  7. tasks/agg-p12-n16-s03/instruction.md +21 -0
  8. tasks/agg-p12-n16-s03/solution/solve.sh +5 -0
  9. tasks/agg-p12-n16-s03/task.toml +27 -0
  10. tasks/agg-p12-n16-s03/tests/expected.json +1 -0
  11. tasks/agg-p12-n16-s03/tests/test.sh +89 -0
  12. tasks/agg-p12-n16-s04/instruction.md +21 -0
  13. tasks/agg-p12-n16-s04/solution/solve.sh +5 -0
  14. tasks/agg-p12-n16-s04/task.toml +27 -0
  15. tasks/agg-p12-n16-s04/tests/expected.json +1 -0
  16. tasks/agg-p12-n16-s04/tests/test.sh +89 -0
  17. tasks/agg-p12-n16-s05/instruction.md +21 -0
  18. tasks/agg-p12-n16-s05/solution/solve.sh +5 -0
  19. tasks/agg-p12-n16-s05/task.toml +27 -0
  20. tasks/agg-p12-n16-s05/tests/expected.json +1 -0
  21. tasks/agg-p12-n16-s05/tests/test.sh +89 -0
  22. tasks/agg-p12-n16-s06/instruction.md +21 -0
  23. tasks/agg-p12-n16-s06/solution/solve.sh +5 -0
  24. tasks/agg-p12-n16-s06/task.toml +27 -0
  25. tasks/agg-p12-n16-s06/tests/expected.json +1 -0
  26. tasks/agg-p12-n16-s06/tests/test.sh +89 -0
  27. tasks/agg-p12-n16-s07/instruction.md +21 -0
  28. tasks/agg-p12-n16-s07/solution/solve.sh +5 -0
  29. tasks/agg-p12-n16-s07/task.toml +27 -0
  30. tasks/agg-p12-n16-s07/tests/expected.json +1 -0
  31. tasks/agg-p12-n16-s07/tests/test.sh +89 -0
  32. tasks/agg-p12-n16-s08/instruction.md +21 -0
  33. tasks/agg-p12-n16-s08/solution/solve.sh +5 -0
  34. tasks/agg-p12-n16-s08/task.toml +27 -0
  35. tasks/agg-p12-n16-s08/tests/expected.json +1 -0
  36. tasks/agg-p12-n16-s08/tests/test.sh +89 -0
  37. tasks/agg-p12-n16-s09/instruction.md +21 -0
  38. tasks/agg-p12-n16-s09/solution/solve.sh +5 -0
  39. tasks/agg-p12-n16-s09/task.toml +27 -0
  40. tasks/agg-p12-n16-s09/tests/expected.json +1 -0
  41. tasks/agg-p12-n16-s09/tests/test.sh +89 -0
  42. tasks/agg-p12-n16-s10/instruction.md +21 -0
  43. tasks/agg-p12-n16-s10/solution/solve.sh +5 -0
  44. tasks/agg-p12-n16-s10/task.toml +27 -0
  45. tasks/agg-p12-n16-s10/tests/expected.json +1 -0
  46. tasks/agg-p12-n16-s10/tests/test.sh +89 -0
  47. tasks/agg-p12-n16-s11/instruction.md +21 -0
  48. tasks/agg-p12-n16-s11/solution/solve.sh +5 -0
  49. tasks/agg-p12-n16-s11/task.toml +27 -0
  50. tasks/agg-p12-n16-s11/tests/expected.json +1 -0
tasks/agg-p12-n16-s01/tests/test.sh ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in
3
+ # ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or
4
+ # unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or
5
+ # booleans, a missing, extra or dropped duplicate number, and a wrong order.
6
+ # The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to
7
+ # /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
8
+ # a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
9
+ # follows a link the agent may have left, and 0 is written before anything is checked, so a crash
10
+ # of the check also scores 0. A copy of the answer stays with the trial's results.
11
+ # Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
12
+ # user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
13
+ # it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
14
+ # rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
15
+ # (no links in them), to test the grader locally.
16
+ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
17
+ export ANSWER=${ANSWER:-/app/answer.json}
18
+ export EXPECTED=${EXPECTED:-$here/expected.json}
19
+ export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
20
+ [ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
21
+ python3 -I -S - <<'PY' || true
22
+ import json
23
+ import os
24
+ import stat
25
+
26
+ LIMIT = 1 << 20 # bytes
27
+
28
+
29
+ def read_own(path):
30
+ # The bytes of the regular file at exactly `path`: every folder on the way is opened
31
+ # without following a link, and so is the file (a FIFO cannot block it); one link only.
32
+ parts = os.path.abspath(path).split("/")[1:]
33
+ folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY)
34
+ try:
35
+ for part in parts[:-1]:
36
+ inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder)
37
+ os.close(folder)
38
+ folder = inner
39
+ fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder)
40
+ finally:
41
+ os.close(folder)
42
+ with os.fdopen(fd, "rb") as stream:
43
+ info = os.fstat(stream.fileno())
44
+ if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1:
45
+ raise ValueError("not a regular file of its own")
46
+ data = stream.read(LIMIT + 1)
47
+ if len(data) > LIMIT:
48
+ raise ValueError("too large")
49
+ return data
50
+
51
+
52
+ def write_new(path, text):
53
+ fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644)
54
+ with os.fdopen(fd, "w") as stream:
55
+ stream.write(text)
56
+
57
+
58
+ def reject_constant(name):
59
+ raise ValueError(f"{name} is not JSON")
60
+
61
+
62
+ def parse(data):
63
+ return json.loads(data.decode("utf-8"), parse_constant=reject_constant)
64
+
65
+
66
+ verifier = os.environ["VERIFIER_DIR"]
67
+ os.makedirs(verifier, exist_ok=True)
68
+ for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
69
+ try:
70
+ os.unlink(os.path.join(verifier, name))
71
+ except FileNotFoundError:
72
+ pass
73
+ write_new(os.path.join(verifier, "reward.txt"), "0")
74
+ valid = False
75
+ try:
76
+ data = read_own(os.environ["ANSWER"])
77
+ write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace"))
78
+ answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"]))
79
+ valid = (
80
+ isinstance(answer, list)
81
+ and all(type(x) is int for x in answer) # not bool, float or str
82
+ and answer == expected
83
+ )
84
+ except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError
85
+ valid = False
86
+ if valid:
87
+ write_new(os.path.join(verifier, "reward.txt"), "1")
88
+ print("reward:", 1 if valid else 0)
89
+ PY
tasks/agg-p12-n16-s02/instruction.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Sort the team's private numbers
2
+
3
+ You are on a team of 16 agents solving a private-information number sorting task. Each agent
4
+ holds one private integer from 1 to 99, written in English words. You know only your own
5
+ number, and the others don't know it unless you tell them.
6
+
7
+ Your private number is fifty.
8
+
9
+ The team must find all 16 numbers and list their numeric values in ascending order. Keep equal
10
+ numbers from different agents as separate entries: each agent's number appears once in the list,
11
+ even when another agent holds the same value.
12
+
13
+ 1. Share your number with the team on the message board.
14
+ 2. Read the board for the other participants' numbers. Note which participant each number came
15
+ from, so that a number posted more than once is counted once.
16
+ 3. Once you have one number from every participant, yourself included, write `/app/answer.json`
17
+ (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order.
18
+ Then stop.
19
+
20
+ Any agent may write the full answer, and the team succeeds if at least one agent's answer is
21
+ correct. Your instructions name the other participants and explain the board's tools.
tasks/agg-p12-n16-s02/solution/solve.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Oracle: the team's answer from its own copy (not tests/), to validate the grader.
3
+ answer=${ANSWER:-/app/answer.json}
4
+ mkdir -p "$(dirname "$answer")"
5
+ echo '[2, 11, 12, 15, 24, 30, 31, 31, 33, 44, 45, 50, 79, 95, 95, 99]' > "$answer"
tasks/agg-p12-n16-s02/task.toml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.4"
2
+
3
+ [task]
4
+ name = "HuggingFaceSwarms/agg-p12-n16-s02"
5
+ version = "0.1.0"
6
+ description = "s3-aggregation: 16 agents each hold a private number; the team lists them all in ascending order."
7
+ keywords = ["multi-agent", "message-board", "s3", "aggregation"]
8
+
9
+ [metadata]
10
+ problem = 12
11
+ agents = 16
12
+ slot = 2
13
+ seed = 115
14
+
15
+ [agent]
16
+ timeout_sec = 1800
17
+
18
+ [environment]
19
+ # Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it
20
+ # too. Nothing task-specific is in the container: the slot's number is only in its instruction,
21
+ # and tests/ arrive only when the agent is done.
22
+ docker_image = "python:3.12-slim"
23
+ cpus = 1
24
+ memory_mb = 1024
25
+
26
+ [verifier]
27
+ timeout_sec = 60
tasks/agg-p12-n16-s02/tests/expected.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [2, 11, 12, 15, 24, 30, 31, 31, 33, 44, 45, 50, 79, 95, 95, 99]
tasks/agg-p12-n16-s02/tests/test.sh ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in
3
+ # ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or
4
+ # unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or
5
+ # booleans, a missing, extra or dropped duplicate number, and a wrong order.
6
+ # The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to
7
+ # /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
8
+ # a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
9
+ # follows a link the agent may have left, and 0 is written before anything is checked, so a crash
10
+ # of the check also scores 0. A copy of the answer stays with the trial's results.
11
+ # Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
12
+ # user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
13
+ # it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
14
+ # rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
15
+ # (no links in them), to test the grader locally.
16
+ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
17
+ export ANSWER=${ANSWER:-/app/answer.json}
18
+ export EXPECTED=${EXPECTED:-$here/expected.json}
19
+ export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
20
+ [ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
21
+ python3 -I -S - <<'PY' || true
22
+ import json
23
+ import os
24
+ import stat
25
+
26
+ LIMIT = 1 << 20 # bytes
27
+
28
+
29
+ def read_own(path):
30
+ # The bytes of the regular file at exactly `path`: every folder on the way is opened
31
+ # without following a link, and so is the file (a FIFO cannot block it); one link only.
32
+ parts = os.path.abspath(path).split("/")[1:]
33
+ folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY)
34
+ try:
35
+ for part in parts[:-1]:
36
+ inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder)
37
+ os.close(folder)
38
+ folder = inner
39
+ fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder)
40
+ finally:
41
+ os.close(folder)
42
+ with os.fdopen(fd, "rb") as stream:
43
+ info = os.fstat(stream.fileno())
44
+ if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1:
45
+ raise ValueError("not a regular file of its own")
46
+ data = stream.read(LIMIT + 1)
47
+ if len(data) > LIMIT:
48
+ raise ValueError("too large")
49
+ return data
50
+
51
+
52
+ def write_new(path, text):
53
+ fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644)
54
+ with os.fdopen(fd, "w") as stream:
55
+ stream.write(text)
56
+
57
+
58
+ def reject_constant(name):
59
+ raise ValueError(f"{name} is not JSON")
60
+
61
+
62
+ def parse(data):
63
+ return json.loads(data.decode("utf-8"), parse_constant=reject_constant)
64
+
65
+
66
+ verifier = os.environ["VERIFIER_DIR"]
67
+ os.makedirs(verifier, exist_ok=True)
68
+ for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
69
+ try:
70
+ os.unlink(os.path.join(verifier, name))
71
+ except FileNotFoundError:
72
+ pass
73
+ write_new(os.path.join(verifier, "reward.txt"), "0")
74
+ valid = False
75
+ try:
76
+ data = read_own(os.environ["ANSWER"])
77
+ write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace"))
78
+ answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"]))
79
+ valid = (
80
+ isinstance(answer, list)
81
+ and all(type(x) is int for x in answer) # not bool, float or str
82
+ and answer == expected
83
+ )
84
+ except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError
85
+ valid = False
86
+ if valid:
87
+ write_new(os.path.join(verifier, "reward.txt"), "1")
88
+ print("reward:", 1 if valid else 0)
89
+ PY
tasks/agg-p12-n16-s03/instruction.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Sort the team's private numbers
2
+
3
+ You are on a team of 16 agents solving a private-information number sorting task. Each agent
4
+ holds one private integer from 1 to 99, written in English words. You know only your own
5
+ number, and the others don't know it unless you tell them.
6
+
7
+ Your private number is ninety-five.
8
+
9
+ The team must find all 16 numbers and list their numeric values in ascending order. Keep equal
10
+ numbers from different agents as separate entries: each agent's number appears once in the list,
11
+ even when another agent holds the same value.
12
+
13
+ 1. Share your number with the team on the message board.
14
+ 2. Read the board for the other participants' numbers. Note which participant each number came
15
+ from, so that a number posted more than once is counted once.
16
+ 3. Once you have one number from every participant, yourself included, write `/app/answer.json`
17
+ (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order.
18
+ Then stop.
19
+
20
+ Any agent may write the full answer, and the team succeeds if at least one agent's answer is
21
+ correct. Your instructions name the other participants and explain the board's tools.
tasks/agg-p12-n16-s03/solution/solve.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Oracle: the team's answer from its own copy (not tests/), to validate the grader.
3
+ answer=${ANSWER:-/app/answer.json}
4
+ mkdir -p "$(dirname "$answer")"
5
+ echo '[2, 11, 12, 15, 24, 30, 31, 31, 33, 44, 45, 50, 79, 95, 95, 99]' > "$answer"
tasks/agg-p12-n16-s03/task.toml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.4"
2
+
3
+ [task]
4
+ name = "HuggingFaceSwarms/agg-p12-n16-s03"
5
+ version = "0.1.0"
6
+ description = "s3-aggregation: 16 agents each hold a private number; the team lists them all in ascending order."
7
+ keywords = ["multi-agent", "message-board", "s3", "aggregation"]
8
+
9
+ [metadata]
10
+ problem = 12
11
+ agents = 16
12
+ slot = 3
13
+ seed = 115
14
+
15
+ [agent]
16
+ timeout_sec = 1800
17
+
18
+ [environment]
19
+ # Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it
20
+ # too. Nothing task-specific is in the container: the slot's number is only in its instruction,
21
+ # and tests/ arrive only when the agent is done.
22
+ docker_image = "python:3.12-slim"
23
+ cpus = 1
24
+ memory_mb = 1024
25
+
26
+ [verifier]
27
+ timeout_sec = 60
tasks/agg-p12-n16-s03/tests/expected.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [2, 11, 12, 15, 24, 30, 31, 31, 33, 44, 45, 50, 79, 95, 95, 99]
tasks/agg-p12-n16-s03/tests/test.sh ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in
3
+ # ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or
4
+ # unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or
5
+ # booleans, a missing, extra or dropped duplicate number, and a wrong order.
6
+ # The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to
7
+ # /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
8
+ # a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
9
+ # follows a link the agent may have left, and 0 is written before anything is checked, so a crash
10
+ # of the check also scores 0. A copy of the answer stays with the trial's results.
11
+ # Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
12
+ # user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
13
+ # it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
14
+ # rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
15
+ # (no links in them), to test the grader locally.
16
+ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
17
+ export ANSWER=${ANSWER:-/app/answer.json}
18
+ export EXPECTED=${EXPECTED:-$here/expected.json}
19
+ export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
20
+ [ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
21
+ python3 -I -S - <<'PY' || true
22
+ import json
23
+ import os
24
+ import stat
25
+
26
+ LIMIT = 1 << 20 # bytes
27
+
28
+
29
+ def read_own(path):
30
+ # The bytes of the regular file at exactly `path`: every folder on the way is opened
31
+ # without following a link, and so is the file (a FIFO cannot block it); one link only.
32
+ parts = os.path.abspath(path).split("/")[1:]
33
+ folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY)
34
+ try:
35
+ for part in parts[:-1]:
36
+ inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder)
37
+ os.close(folder)
38
+ folder = inner
39
+ fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder)
40
+ finally:
41
+ os.close(folder)
42
+ with os.fdopen(fd, "rb") as stream:
43
+ info = os.fstat(stream.fileno())
44
+ if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1:
45
+ raise ValueError("not a regular file of its own")
46
+ data = stream.read(LIMIT + 1)
47
+ if len(data) > LIMIT:
48
+ raise ValueError("too large")
49
+ return data
50
+
51
+
52
+ def write_new(path, text):
53
+ fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644)
54
+ with os.fdopen(fd, "w") as stream:
55
+ stream.write(text)
56
+
57
+
58
+ def reject_constant(name):
59
+ raise ValueError(f"{name} is not JSON")
60
+
61
+
62
+ def parse(data):
63
+ return json.loads(data.decode("utf-8"), parse_constant=reject_constant)
64
+
65
+
66
+ verifier = os.environ["VERIFIER_DIR"]
67
+ os.makedirs(verifier, exist_ok=True)
68
+ for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
69
+ try:
70
+ os.unlink(os.path.join(verifier, name))
71
+ except FileNotFoundError:
72
+ pass
73
+ write_new(os.path.join(verifier, "reward.txt"), "0")
74
+ valid = False
75
+ try:
76
+ data = read_own(os.environ["ANSWER"])
77
+ write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace"))
78
+ answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"]))
79
+ valid = (
80
+ isinstance(answer, list)
81
+ and all(type(x) is int for x in answer) # not bool, float or str
82
+ and answer == expected
83
+ )
84
+ except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError
85
+ valid = False
86
+ if valid:
87
+ write_new(os.path.join(verifier, "reward.txt"), "1")
88
+ print("reward:", 1 if valid else 0)
89
+ PY
tasks/agg-p12-n16-s04/instruction.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Sort the team's private numbers
2
+
3
+ You are on a team of 16 agents solving a private-information number sorting task. Each agent
4
+ holds one private integer from 1 to 99, written in English words. You know only your own
5
+ number, and the others don't know it unless you tell them.
6
+
7
+ Your private number is twelve.
8
+
9
+ The team must find all 16 numbers and list their numeric values in ascending order. Keep equal
10
+ numbers from different agents as separate entries: each agent's number appears once in the list,
11
+ even when another agent holds the same value.
12
+
13
+ 1. Share your number with the team on the message board.
14
+ 2. Read the board for the other participants' numbers. Note which participant each number came
15
+ from, so that a number posted more than once is counted once.
16
+ 3. Once you have one number from every participant, yourself included, write `/app/answer.json`
17
+ (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order.
18
+ Then stop.
19
+
20
+ Any agent may write the full answer, and the team succeeds if at least one agent's answer is
21
+ correct. Your instructions name the other participants and explain the board's tools.
tasks/agg-p12-n16-s04/solution/solve.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Oracle: the team's answer from its own copy (not tests/), to validate the grader.
3
+ answer=${ANSWER:-/app/answer.json}
4
+ mkdir -p "$(dirname "$answer")"
5
+ echo '[2, 11, 12, 15, 24, 30, 31, 31, 33, 44, 45, 50, 79, 95, 95, 99]' > "$answer"
tasks/agg-p12-n16-s04/task.toml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.4"
2
+
3
+ [task]
4
+ name = "HuggingFaceSwarms/agg-p12-n16-s04"
5
+ version = "0.1.0"
6
+ description = "s3-aggregation: 16 agents each hold a private number; the team lists them all in ascending order."
7
+ keywords = ["multi-agent", "message-board", "s3", "aggregation"]
8
+
9
+ [metadata]
10
+ problem = 12
11
+ agents = 16
12
+ slot = 4
13
+ seed = 115
14
+
15
+ [agent]
16
+ timeout_sec = 1800
17
+
18
+ [environment]
19
+ # Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it
20
+ # too. Nothing task-specific is in the container: the slot's number is only in its instruction,
21
+ # and tests/ arrive only when the agent is done.
22
+ docker_image = "python:3.12-slim"
23
+ cpus = 1
24
+ memory_mb = 1024
25
+
26
+ [verifier]
27
+ timeout_sec = 60
tasks/agg-p12-n16-s04/tests/expected.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [2, 11, 12, 15, 24, 30, 31, 31, 33, 44, 45, 50, 79, 95, 95, 99]
tasks/agg-p12-n16-s04/tests/test.sh ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in
3
+ # ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or
4
+ # unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or
5
+ # booleans, a missing, extra or dropped duplicate number, and a wrong order.
6
+ # The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to
7
+ # /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
8
+ # a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
9
+ # follows a link the agent may have left, and 0 is written before anything is checked, so a crash
10
+ # of the check also scores 0. A copy of the answer stays with the trial's results.
11
+ # Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
12
+ # user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
13
+ # it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
14
+ # rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
15
+ # (no links in them), to test the grader locally.
16
+ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
17
+ export ANSWER=${ANSWER:-/app/answer.json}
18
+ export EXPECTED=${EXPECTED:-$here/expected.json}
19
+ export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
20
+ [ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
21
+ python3 -I -S - <<'PY' || true
22
+ import json
23
+ import os
24
+ import stat
25
+
26
+ LIMIT = 1 << 20 # bytes
27
+
28
+
29
+ def read_own(path):
30
+ # The bytes of the regular file at exactly `path`: every folder on the way is opened
31
+ # without following a link, and so is the file (a FIFO cannot block it); one link only.
32
+ parts = os.path.abspath(path).split("/")[1:]
33
+ folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY)
34
+ try:
35
+ for part in parts[:-1]:
36
+ inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder)
37
+ os.close(folder)
38
+ folder = inner
39
+ fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder)
40
+ finally:
41
+ os.close(folder)
42
+ with os.fdopen(fd, "rb") as stream:
43
+ info = os.fstat(stream.fileno())
44
+ if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1:
45
+ raise ValueError("not a regular file of its own")
46
+ data = stream.read(LIMIT + 1)
47
+ if len(data) > LIMIT:
48
+ raise ValueError("too large")
49
+ return data
50
+
51
+
52
+ def write_new(path, text):
53
+ fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644)
54
+ with os.fdopen(fd, "w") as stream:
55
+ stream.write(text)
56
+
57
+
58
+ def reject_constant(name):
59
+ raise ValueError(f"{name} is not JSON")
60
+
61
+
62
+ def parse(data):
63
+ return json.loads(data.decode("utf-8"), parse_constant=reject_constant)
64
+
65
+
66
+ verifier = os.environ["VERIFIER_DIR"]
67
+ os.makedirs(verifier, exist_ok=True)
68
+ for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
69
+ try:
70
+ os.unlink(os.path.join(verifier, name))
71
+ except FileNotFoundError:
72
+ pass
73
+ write_new(os.path.join(verifier, "reward.txt"), "0")
74
+ valid = False
75
+ try:
76
+ data = read_own(os.environ["ANSWER"])
77
+ write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace"))
78
+ answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"]))
79
+ valid = (
80
+ isinstance(answer, list)
81
+ and all(type(x) is int for x in answer) # not bool, float or str
82
+ and answer == expected
83
+ )
84
+ except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError
85
+ valid = False
86
+ if valid:
87
+ write_new(os.path.join(verifier, "reward.txt"), "1")
88
+ print("reward:", 1 if valid else 0)
89
+ PY
tasks/agg-p12-n16-s05/instruction.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Sort the team's private numbers
2
+
3
+ You are on a team of 16 agents solving a private-information number sorting task. Each agent
4
+ holds one private integer from 1 to 99, written in English words. You know only your own
5
+ number, and the others don't know it unless you tell them.
6
+
7
+ Your private number is ninety-nine.
8
+
9
+ The team must find all 16 numbers and list their numeric values in ascending order. Keep equal
10
+ numbers from different agents as separate entries: each agent's number appears once in the list,
11
+ even when another agent holds the same value.
12
+
13
+ 1. Share your number with the team on the message board.
14
+ 2. Read the board for the other participants' numbers. Note which participant each number came
15
+ from, so that a number posted more than once is counted once.
16
+ 3. Once you have one number from every participant, yourself included, write `/app/answer.json`
17
+ (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order.
18
+ Then stop.
19
+
20
+ Any agent may write the full answer, and the team succeeds if at least one agent's answer is
21
+ correct. Your instructions name the other participants and explain the board's tools.
tasks/agg-p12-n16-s05/solution/solve.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Oracle: the team's answer from its own copy (not tests/), to validate the grader.
3
+ answer=${ANSWER:-/app/answer.json}
4
+ mkdir -p "$(dirname "$answer")"
5
+ echo '[2, 11, 12, 15, 24, 30, 31, 31, 33, 44, 45, 50, 79, 95, 95, 99]' > "$answer"
tasks/agg-p12-n16-s05/task.toml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.4"
2
+
3
+ [task]
4
+ name = "HuggingFaceSwarms/agg-p12-n16-s05"
5
+ version = "0.1.0"
6
+ description = "s3-aggregation: 16 agents each hold a private number; the team lists them all in ascending order."
7
+ keywords = ["multi-agent", "message-board", "s3", "aggregation"]
8
+
9
+ [metadata]
10
+ problem = 12
11
+ agents = 16
12
+ slot = 5
13
+ seed = 115
14
+
15
+ [agent]
16
+ timeout_sec = 1800
17
+
18
+ [environment]
19
+ # Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it
20
+ # too. Nothing task-specific is in the container: the slot's number is only in its instruction,
21
+ # and tests/ arrive only when the agent is done.
22
+ docker_image = "python:3.12-slim"
23
+ cpus = 1
24
+ memory_mb = 1024
25
+
26
+ [verifier]
27
+ timeout_sec = 60
tasks/agg-p12-n16-s05/tests/expected.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [2, 11, 12, 15, 24, 30, 31, 31, 33, 44, 45, 50, 79, 95, 95, 99]
tasks/agg-p12-n16-s05/tests/test.sh ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in
3
+ # ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or
4
+ # unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or
5
+ # booleans, a missing, extra or dropped duplicate number, and a wrong order.
6
+ # The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to
7
+ # /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
8
+ # a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
9
+ # follows a link the agent may have left, and 0 is written before anything is checked, so a crash
10
+ # of the check also scores 0. A copy of the answer stays with the trial's results.
11
+ # Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
12
+ # user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
13
+ # it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
14
+ # rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
15
+ # (no links in them), to test the grader locally.
16
+ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
17
+ export ANSWER=${ANSWER:-/app/answer.json}
18
+ export EXPECTED=${EXPECTED:-$here/expected.json}
19
+ export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
20
+ [ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
21
+ python3 -I -S - <<'PY' || true
22
+ import json
23
+ import os
24
+ import stat
25
+
26
+ LIMIT = 1 << 20 # bytes
27
+
28
+
29
+ def read_own(path):
30
+ # The bytes of the regular file at exactly `path`: every folder on the way is opened
31
+ # without following a link, and so is the file (a FIFO cannot block it); one link only.
32
+ parts = os.path.abspath(path).split("/")[1:]
33
+ folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY)
34
+ try:
35
+ for part in parts[:-1]:
36
+ inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder)
37
+ os.close(folder)
38
+ folder = inner
39
+ fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder)
40
+ finally:
41
+ os.close(folder)
42
+ with os.fdopen(fd, "rb") as stream:
43
+ info = os.fstat(stream.fileno())
44
+ if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1:
45
+ raise ValueError("not a regular file of its own")
46
+ data = stream.read(LIMIT + 1)
47
+ if len(data) > LIMIT:
48
+ raise ValueError("too large")
49
+ return data
50
+
51
+
52
+ def write_new(path, text):
53
+ fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644)
54
+ with os.fdopen(fd, "w") as stream:
55
+ stream.write(text)
56
+
57
+
58
+ def reject_constant(name):
59
+ raise ValueError(f"{name} is not JSON")
60
+
61
+
62
+ def parse(data):
63
+ return json.loads(data.decode("utf-8"), parse_constant=reject_constant)
64
+
65
+
66
+ verifier = os.environ["VERIFIER_DIR"]
67
+ os.makedirs(verifier, exist_ok=True)
68
+ for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
69
+ try:
70
+ os.unlink(os.path.join(verifier, name))
71
+ except FileNotFoundError:
72
+ pass
73
+ write_new(os.path.join(verifier, "reward.txt"), "0")
74
+ valid = False
75
+ try:
76
+ data = read_own(os.environ["ANSWER"])
77
+ write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace"))
78
+ answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"]))
79
+ valid = (
80
+ isinstance(answer, list)
81
+ and all(type(x) is int for x in answer) # not bool, float or str
82
+ and answer == expected
83
+ )
84
+ except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError
85
+ valid = False
86
+ if valid:
87
+ write_new(os.path.join(verifier, "reward.txt"), "1")
88
+ print("reward:", 1 if valid else 0)
89
+ PY
tasks/agg-p12-n16-s06/instruction.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Sort the team's private numbers
2
+
3
+ You are on a team of 16 agents solving a private-information number sorting task. Each agent
4
+ holds one private integer from 1 to 99, written in English words. You know only your own
5
+ number, and the others don't know it unless you tell them.
6
+
7
+ Your private number is thirty.
8
+
9
+ The team must find all 16 numbers and list their numeric values in ascending order. Keep equal
10
+ numbers from different agents as separate entries: each agent's number appears once in the list,
11
+ even when another agent holds the same value.
12
+
13
+ 1. Share your number with the team on the message board.
14
+ 2. Read the board for the other participants' numbers. Note which participant each number came
15
+ from, so that a number posted more than once is counted once.
16
+ 3. Once you have one number from every participant, yourself included, write `/app/answer.json`
17
+ (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order.
18
+ Then stop.
19
+
20
+ Any agent may write the full answer, and the team succeeds if at least one agent's answer is
21
+ correct. Your instructions name the other participants and explain the board's tools.
tasks/agg-p12-n16-s06/solution/solve.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Oracle: the team's answer from its own copy (not tests/), to validate the grader.
3
+ answer=${ANSWER:-/app/answer.json}
4
+ mkdir -p "$(dirname "$answer")"
5
+ echo '[2, 11, 12, 15, 24, 30, 31, 31, 33, 44, 45, 50, 79, 95, 95, 99]' > "$answer"
tasks/agg-p12-n16-s06/task.toml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.4"
2
+
3
+ [task]
4
+ name = "HuggingFaceSwarms/agg-p12-n16-s06"
5
+ version = "0.1.0"
6
+ description = "s3-aggregation: 16 agents each hold a private number; the team lists them all in ascending order."
7
+ keywords = ["multi-agent", "message-board", "s3", "aggregation"]
8
+
9
+ [metadata]
10
+ problem = 12
11
+ agents = 16
12
+ slot = 6
13
+ seed = 115
14
+
15
+ [agent]
16
+ timeout_sec = 1800
17
+
18
+ [environment]
19
+ # Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it
20
+ # too. Nothing task-specific is in the container: the slot's number is only in its instruction,
21
+ # and tests/ arrive only when the agent is done.
22
+ docker_image = "python:3.12-slim"
23
+ cpus = 1
24
+ memory_mb = 1024
25
+
26
+ [verifier]
27
+ timeout_sec = 60
tasks/agg-p12-n16-s06/tests/expected.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [2, 11, 12, 15, 24, 30, 31, 31, 33, 44, 45, 50, 79, 95, 95, 99]
tasks/agg-p12-n16-s06/tests/test.sh ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in
3
+ # ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or
4
+ # unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or
5
+ # booleans, a missing, extra or dropped duplicate number, and a wrong order.
6
+ # The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to
7
+ # /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
8
+ # a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
9
+ # follows a link the agent may have left, and 0 is written before anything is checked, so a crash
10
+ # of the check also scores 0. A copy of the answer stays with the trial's results.
11
+ # Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
12
+ # user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
13
+ # it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
14
+ # rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
15
+ # (no links in them), to test the grader locally.
16
+ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
17
+ export ANSWER=${ANSWER:-/app/answer.json}
18
+ export EXPECTED=${EXPECTED:-$here/expected.json}
19
+ export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
20
+ [ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
21
+ python3 -I -S - <<'PY' || true
22
+ import json
23
+ import os
24
+ import stat
25
+
26
+ LIMIT = 1 << 20 # bytes
27
+
28
+
29
+ def read_own(path):
30
+ # The bytes of the regular file at exactly `path`: every folder on the way is opened
31
+ # without following a link, and so is the file (a FIFO cannot block it); one link only.
32
+ parts = os.path.abspath(path).split("/")[1:]
33
+ folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY)
34
+ try:
35
+ for part in parts[:-1]:
36
+ inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder)
37
+ os.close(folder)
38
+ folder = inner
39
+ fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder)
40
+ finally:
41
+ os.close(folder)
42
+ with os.fdopen(fd, "rb") as stream:
43
+ info = os.fstat(stream.fileno())
44
+ if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1:
45
+ raise ValueError("not a regular file of its own")
46
+ data = stream.read(LIMIT + 1)
47
+ if len(data) > LIMIT:
48
+ raise ValueError("too large")
49
+ return data
50
+
51
+
52
+ def write_new(path, text):
53
+ fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644)
54
+ with os.fdopen(fd, "w") as stream:
55
+ stream.write(text)
56
+
57
+
58
+ def reject_constant(name):
59
+ raise ValueError(f"{name} is not JSON")
60
+
61
+
62
+ def parse(data):
63
+ return json.loads(data.decode("utf-8"), parse_constant=reject_constant)
64
+
65
+
66
+ verifier = os.environ["VERIFIER_DIR"]
67
+ os.makedirs(verifier, exist_ok=True)
68
+ for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
69
+ try:
70
+ os.unlink(os.path.join(verifier, name))
71
+ except FileNotFoundError:
72
+ pass
73
+ write_new(os.path.join(verifier, "reward.txt"), "0")
74
+ valid = False
75
+ try:
76
+ data = read_own(os.environ["ANSWER"])
77
+ write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace"))
78
+ answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"]))
79
+ valid = (
80
+ isinstance(answer, list)
81
+ and all(type(x) is int for x in answer) # not bool, float or str
82
+ and answer == expected
83
+ )
84
+ except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError
85
+ valid = False
86
+ if valid:
87
+ write_new(os.path.join(verifier, "reward.txt"), "1")
88
+ print("reward:", 1 if valid else 0)
89
+ PY
tasks/agg-p12-n16-s07/instruction.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Sort the team's private numbers
2
+
3
+ You are on a team of 16 agents solving a private-information number sorting task. Each agent
4
+ holds one private integer from 1 to 99, written in English words. You know only your own
5
+ number, and the others don't know it unless you tell them.
6
+
7
+ Your private number is fifteen.
8
+
9
+ The team must find all 16 numbers and list their numeric values in ascending order. Keep equal
10
+ numbers from different agents as separate entries: each agent's number appears once in the list,
11
+ even when another agent holds the same value.
12
+
13
+ 1. Share your number with the team on the message board.
14
+ 2. Read the board for the other participants' numbers. Note which participant each number came
15
+ from, so that a number posted more than once is counted once.
16
+ 3. Once you have one number from every participant, yourself included, write `/app/answer.json`
17
+ (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order.
18
+ Then stop.
19
+
20
+ Any agent may write the full answer, and the team succeeds if at least one agent's answer is
21
+ correct. Your instructions name the other participants and explain the board's tools.
tasks/agg-p12-n16-s07/solution/solve.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Oracle: the team's answer from its own copy (not tests/), to validate the grader.
3
+ answer=${ANSWER:-/app/answer.json}
4
+ mkdir -p "$(dirname "$answer")"
5
+ echo '[2, 11, 12, 15, 24, 30, 31, 31, 33, 44, 45, 50, 79, 95, 95, 99]' > "$answer"
tasks/agg-p12-n16-s07/task.toml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.4"
2
+
3
+ [task]
4
+ name = "HuggingFaceSwarms/agg-p12-n16-s07"
5
+ version = "0.1.0"
6
+ description = "s3-aggregation: 16 agents each hold a private number; the team lists them all in ascending order."
7
+ keywords = ["multi-agent", "message-board", "s3", "aggregation"]
8
+
9
+ [metadata]
10
+ problem = 12
11
+ agents = 16
12
+ slot = 7
13
+ seed = 115
14
+
15
+ [agent]
16
+ timeout_sec = 1800
17
+
18
+ [environment]
19
+ # Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it
20
+ # too. Nothing task-specific is in the container: the slot's number is only in its instruction,
21
+ # and tests/ arrive only when the agent is done.
22
+ docker_image = "python:3.12-slim"
23
+ cpus = 1
24
+ memory_mb = 1024
25
+
26
+ [verifier]
27
+ timeout_sec = 60
tasks/agg-p12-n16-s07/tests/expected.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [2, 11, 12, 15, 24, 30, 31, 31, 33, 44, 45, 50, 79, 95, 95, 99]
tasks/agg-p12-n16-s07/tests/test.sh ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in
3
+ # ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or
4
+ # unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or
5
+ # booleans, a missing, extra or dropped duplicate number, and a wrong order.
6
+ # The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to
7
+ # /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
8
+ # a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
9
+ # follows a link the agent may have left, and 0 is written before anything is checked, so a crash
10
+ # of the check also scores 0. A copy of the answer stays with the trial's results.
11
+ # Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
12
+ # user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
13
+ # it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
14
+ # rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
15
+ # (no links in them), to test the grader locally.
16
+ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
17
+ export ANSWER=${ANSWER:-/app/answer.json}
18
+ export EXPECTED=${EXPECTED:-$here/expected.json}
19
+ export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
20
+ [ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
21
+ python3 -I -S - <<'PY' || true
22
+ import json
23
+ import os
24
+ import stat
25
+
26
+ LIMIT = 1 << 20 # bytes
27
+
28
+
29
+ def read_own(path):
30
+ # The bytes of the regular file at exactly `path`: every folder on the way is opened
31
+ # without following a link, and so is the file (a FIFO cannot block it); one link only.
32
+ parts = os.path.abspath(path).split("/")[1:]
33
+ folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY)
34
+ try:
35
+ for part in parts[:-1]:
36
+ inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder)
37
+ os.close(folder)
38
+ folder = inner
39
+ fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder)
40
+ finally:
41
+ os.close(folder)
42
+ with os.fdopen(fd, "rb") as stream:
43
+ info = os.fstat(stream.fileno())
44
+ if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1:
45
+ raise ValueError("not a regular file of its own")
46
+ data = stream.read(LIMIT + 1)
47
+ if len(data) > LIMIT:
48
+ raise ValueError("too large")
49
+ return data
50
+
51
+
52
+ def write_new(path, text):
53
+ fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644)
54
+ with os.fdopen(fd, "w") as stream:
55
+ stream.write(text)
56
+
57
+
58
+ def reject_constant(name):
59
+ raise ValueError(f"{name} is not JSON")
60
+
61
+
62
+ def parse(data):
63
+ return json.loads(data.decode("utf-8"), parse_constant=reject_constant)
64
+
65
+
66
+ verifier = os.environ["VERIFIER_DIR"]
67
+ os.makedirs(verifier, exist_ok=True)
68
+ for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
69
+ try:
70
+ os.unlink(os.path.join(verifier, name))
71
+ except FileNotFoundError:
72
+ pass
73
+ write_new(os.path.join(verifier, "reward.txt"), "0")
74
+ valid = False
75
+ try:
76
+ data = read_own(os.environ["ANSWER"])
77
+ write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace"))
78
+ answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"]))
79
+ valid = (
80
+ isinstance(answer, list)
81
+ and all(type(x) is int for x in answer) # not bool, float or str
82
+ and answer == expected
83
+ )
84
+ except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError
85
+ valid = False
86
+ if valid:
87
+ write_new(os.path.join(verifier, "reward.txt"), "1")
88
+ print("reward:", 1 if valid else 0)
89
+ PY
tasks/agg-p12-n16-s08/instruction.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Sort the team's private numbers
2
+
3
+ You are on a team of 16 agents solving a private-information number sorting task. Each agent
4
+ holds one private integer from 1 to 99, written in English words. You know only your own
5
+ number, and the others don't know it unless you tell them.
6
+
7
+ Your private number is thirty-one.
8
+
9
+ The team must find all 16 numbers and list their numeric values in ascending order. Keep equal
10
+ numbers from different agents as separate entries: each agent's number appears once in the list,
11
+ even when another agent holds the same value.
12
+
13
+ 1. Share your number with the team on the message board.
14
+ 2. Read the board for the other participants' numbers. Note which participant each number came
15
+ from, so that a number posted more than once is counted once.
16
+ 3. Once you have one number from every participant, yourself included, write `/app/answer.json`
17
+ (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order.
18
+ Then stop.
19
+
20
+ Any agent may write the full answer, and the team succeeds if at least one agent's answer is
21
+ correct. Your instructions name the other participants and explain the board's tools.
tasks/agg-p12-n16-s08/solution/solve.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Oracle: the team's answer from its own copy (not tests/), to validate the grader.
3
+ answer=${ANSWER:-/app/answer.json}
4
+ mkdir -p "$(dirname "$answer")"
5
+ echo '[2, 11, 12, 15, 24, 30, 31, 31, 33, 44, 45, 50, 79, 95, 95, 99]' > "$answer"
tasks/agg-p12-n16-s08/task.toml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.4"
2
+
3
+ [task]
4
+ name = "HuggingFaceSwarms/agg-p12-n16-s08"
5
+ version = "0.1.0"
6
+ description = "s3-aggregation: 16 agents each hold a private number; the team lists them all in ascending order."
7
+ keywords = ["multi-agent", "message-board", "s3", "aggregation"]
8
+
9
+ [metadata]
10
+ problem = 12
11
+ agents = 16
12
+ slot = 8
13
+ seed = 115
14
+
15
+ [agent]
16
+ timeout_sec = 1800
17
+
18
+ [environment]
19
+ # Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it
20
+ # too. Nothing task-specific is in the container: the slot's number is only in its instruction,
21
+ # and tests/ arrive only when the agent is done.
22
+ docker_image = "python:3.12-slim"
23
+ cpus = 1
24
+ memory_mb = 1024
25
+
26
+ [verifier]
27
+ timeout_sec = 60
tasks/agg-p12-n16-s08/tests/expected.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [2, 11, 12, 15, 24, 30, 31, 31, 33, 44, 45, 50, 79, 95, 95, 99]
tasks/agg-p12-n16-s08/tests/test.sh ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in
3
+ # ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or
4
+ # unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or
5
+ # booleans, a missing, extra or dropped duplicate number, and a wrong order.
6
+ # The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to
7
+ # /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
8
+ # a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
9
+ # follows a link the agent may have left, and 0 is written before anything is checked, so a crash
10
+ # of the check also scores 0. A copy of the answer stays with the trial's results.
11
+ # Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
12
+ # user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
13
+ # it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
14
+ # rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
15
+ # (no links in them), to test the grader locally.
16
+ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
17
+ export ANSWER=${ANSWER:-/app/answer.json}
18
+ export EXPECTED=${EXPECTED:-$here/expected.json}
19
+ export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
20
+ [ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
21
+ python3 -I -S - <<'PY' || true
22
+ import json
23
+ import os
24
+ import stat
25
+
26
+ LIMIT = 1 << 20 # bytes
27
+
28
+
29
+ def read_own(path):
30
+ # The bytes of the regular file at exactly `path`: every folder on the way is opened
31
+ # without following a link, and so is the file (a FIFO cannot block it); one link only.
32
+ parts = os.path.abspath(path).split("/")[1:]
33
+ folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY)
34
+ try:
35
+ for part in parts[:-1]:
36
+ inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder)
37
+ os.close(folder)
38
+ folder = inner
39
+ fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder)
40
+ finally:
41
+ os.close(folder)
42
+ with os.fdopen(fd, "rb") as stream:
43
+ info = os.fstat(stream.fileno())
44
+ if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1:
45
+ raise ValueError("not a regular file of its own")
46
+ data = stream.read(LIMIT + 1)
47
+ if len(data) > LIMIT:
48
+ raise ValueError("too large")
49
+ return data
50
+
51
+
52
+ def write_new(path, text):
53
+ fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644)
54
+ with os.fdopen(fd, "w") as stream:
55
+ stream.write(text)
56
+
57
+
58
+ def reject_constant(name):
59
+ raise ValueError(f"{name} is not JSON")
60
+
61
+
62
+ def parse(data):
63
+ return json.loads(data.decode("utf-8"), parse_constant=reject_constant)
64
+
65
+
66
+ verifier = os.environ["VERIFIER_DIR"]
67
+ os.makedirs(verifier, exist_ok=True)
68
+ for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
69
+ try:
70
+ os.unlink(os.path.join(verifier, name))
71
+ except FileNotFoundError:
72
+ pass
73
+ write_new(os.path.join(verifier, "reward.txt"), "0")
74
+ valid = False
75
+ try:
76
+ data = read_own(os.environ["ANSWER"])
77
+ write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace"))
78
+ answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"]))
79
+ valid = (
80
+ isinstance(answer, list)
81
+ and all(type(x) is int for x in answer) # not bool, float or str
82
+ and answer == expected
83
+ )
84
+ except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError
85
+ valid = False
86
+ if valid:
87
+ write_new(os.path.join(verifier, "reward.txt"), "1")
88
+ print("reward:", 1 if valid else 0)
89
+ PY
tasks/agg-p12-n16-s09/instruction.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Sort the team's private numbers
2
+
3
+ You are on a team of 16 agents solving a private-information number sorting task. Each agent
4
+ holds one private integer from 1 to 99, written in English words. You know only your own
5
+ number, and the others don't know it unless you tell them.
6
+
7
+ Your private number is forty-five.
8
+
9
+ The team must find all 16 numbers and list their numeric values in ascending order. Keep equal
10
+ numbers from different agents as separate entries: each agent's number appears once in the list,
11
+ even when another agent holds the same value.
12
+
13
+ 1. Share your number with the team on the message board.
14
+ 2. Read the board for the other participants' numbers. Note which participant each number came
15
+ from, so that a number posted more than once is counted once.
16
+ 3. Once you have one number from every participant, yourself included, write `/app/answer.json`
17
+ (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order.
18
+ Then stop.
19
+
20
+ Any agent may write the full answer, and the team succeeds if at least one agent's answer is
21
+ correct. Your instructions name the other participants and explain the board's tools.
tasks/agg-p12-n16-s09/solution/solve.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Oracle: the team's answer from its own copy (not tests/), to validate the grader.
3
+ answer=${ANSWER:-/app/answer.json}
4
+ mkdir -p "$(dirname "$answer")"
5
+ echo '[2, 11, 12, 15, 24, 30, 31, 31, 33, 44, 45, 50, 79, 95, 95, 99]' > "$answer"
tasks/agg-p12-n16-s09/task.toml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.4"
2
+
3
+ [task]
4
+ name = "HuggingFaceSwarms/agg-p12-n16-s09"
5
+ version = "0.1.0"
6
+ description = "s3-aggregation: 16 agents each hold a private number; the team lists them all in ascending order."
7
+ keywords = ["multi-agent", "message-board", "s3", "aggregation"]
8
+
9
+ [metadata]
10
+ problem = 12
11
+ agents = 16
12
+ slot = 9
13
+ seed = 115
14
+
15
+ [agent]
16
+ timeout_sec = 1800
17
+
18
+ [environment]
19
+ # Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it
20
+ # too. Nothing task-specific is in the container: the slot's number is only in its instruction,
21
+ # and tests/ arrive only when the agent is done.
22
+ docker_image = "python:3.12-slim"
23
+ cpus = 1
24
+ memory_mb = 1024
25
+
26
+ [verifier]
27
+ timeout_sec = 60
tasks/agg-p12-n16-s09/tests/expected.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [2, 11, 12, 15, 24, 30, 31, 31, 33, 44, 45, 50, 79, 95, 95, 99]
tasks/agg-p12-n16-s09/tests/test.sh ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in
3
+ # ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or
4
+ # unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or
5
+ # booleans, a missing, extra or dropped duplicate number, and a wrong order.
6
+ # The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to
7
+ # /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
8
+ # a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
9
+ # follows a link the agent may have left, and 0 is written before anything is checked, so a crash
10
+ # of the check also scores 0. A copy of the answer stays with the trial's results.
11
+ # Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
12
+ # user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
13
+ # it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
14
+ # rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
15
+ # (no links in them), to test the grader locally.
16
+ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
17
+ export ANSWER=${ANSWER:-/app/answer.json}
18
+ export EXPECTED=${EXPECTED:-$here/expected.json}
19
+ export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
20
+ [ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
21
+ python3 -I -S - <<'PY' || true
22
+ import json
23
+ import os
24
+ import stat
25
+
26
+ LIMIT = 1 << 20 # bytes
27
+
28
+
29
+ def read_own(path):
30
+ # The bytes of the regular file at exactly `path`: every folder on the way is opened
31
+ # without following a link, and so is the file (a FIFO cannot block it); one link only.
32
+ parts = os.path.abspath(path).split("/")[1:]
33
+ folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY)
34
+ try:
35
+ for part in parts[:-1]:
36
+ inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder)
37
+ os.close(folder)
38
+ folder = inner
39
+ fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder)
40
+ finally:
41
+ os.close(folder)
42
+ with os.fdopen(fd, "rb") as stream:
43
+ info = os.fstat(stream.fileno())
44
+ if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1:
45
+ raise ValueError("not a regular file of its own")
46
+ data = stream.read(LIMIT + 1)
47
+ if len(data) > LIMIT:
48
+ raise ValueError("too large")
49
+ return data
50
+
51
+
52
+ def write_new(path, text):
53
+ fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644)
54
+ with os.fdopen(fd, "w") as stream:
55
+ stream.write(text)
56
+
57
+
58
+ def reject_constant(name):
59
+ raise ValueError(f"{name} is not JSON")
60
+
61
+
62
+ def parse(data):
63
+ return json.loads(data.decode("utf-8"), parse_constant=reject_constant)
64
+
65
+
66
+ verifier = os.environ["VERIFIER_DIR"]
67
+ os.makedirs(verifier, exist_ok=True)
68
+ for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
69
+ try:
70
+ os.unlink(os.path.join(verifier, name))
71
+ except FileNotFoundError:
72
+ pass
73
+ write_new(os.path.join(verifier, "reward.txt"), "0")
74
+ valid = False
75
+ try:
76
+ data = read_own(os.environ["ANSWER"])
77
+ write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace"))
78
+ answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"]))
79
+ valid = (
80
+ isinstance(answer, list)
81
+ and all(type(x) is int for x in answer) # not bool, float or str
82
+ and answer == expected
83
+ )
84
+ except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError
85
+ valid = False
86
+ if valid:
87
+ write_new(os.path.join(verifier, "reward.txt"), "1")
88
+ print("reward:", 1 if valid else 0)
89
+ PY
tasks/agg-p12-n16-s10/instruction.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Sort the team's private numbers
2
+
3
+ You are on a team of 16 agents solving a private-information number sorting task. Each agent
4
+ holds one private integer from 1 to 99, written in English words. You know only your own
5
+ number, and the others don't know it unless you tell them.
6
+
7
+ Your private number is forty-four.
8
+
9
+ The team must find all 16 numbers and list their numeric values in ascending order. Keep equal
10
+ numbers from different agents as separate entries: each agent's number appears once in the list,
11
+ even when another agent holds the same value.
12
+
13
+ 1. Share your number with the team on the message board.
14
+ 2. Read the board for the other participants' numbers. Note which participant each number came
15
+ from, so that a number posted more than once is counted once.
16
+ 3. Once you have one number from every participant, yourself included, write `/app/answer.json`
17
+ (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order.
18
+ Then stop.
19
+
20
+ Any agent may write the full answer, and the team succeeds if at least one agent's answer is
21
+ correct. Your instructions name the other participants and explain the board's tools.
tasks/agg-p12-n16-s10/solution/solve.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Oracle: the team's answer from its own copy (not tests/), to validate the grader.
3
+ answer=${ANSWER:-/app/answer.json}
4
+ mkdir -p "$(dirname "$answer")"
5
+ echo '[2, 11, 12, 15, 24, 30, 31, 31, 33, 44, 45, 50, 79, 95, 95, 99]' > "$answer"
tasks/agg-p12-n16-s10/task.toml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.4"
2
+
3
+ [task]
4
+ name = "HuggingFaceSwarms/agg-p12-n16-s10"
5
+ version = "0.1.0"
6
+ description = "s3-aggregation: 16 agents each hold a private number; the team lists them all in ascending order."
7
+ keywords = ["multi-agent", "message-board", "s3", "aggregation"]
8
+
9
+ [metadata]
10
+ problem = 12
11
+ agents = 16
12
+ slot = 10
13
+ seed = 115
14
+
15
+ [agent]
16
+ timeout_sec = 1800
17
+
18
+ [environment]
19
+ # Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it
20
+ # too. Nothing task-specific is in the container: the slot's number is only in its instruction,
21
+ # and tests/ arrive only when the agent is done.
22
+ docker_image = "python:3.12-slim"
23
+ cpus = 1
24
+ memory_mb = 1024
25
+
26
+ [verifier]
27
+ timeout_sec = 60
tasks/agg-p12-n16-s10/tests/expected.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [2, 11, 12, 15, 24, 30, 31, 31, 33, 44, 45, 50, 79, 95, 95, 99]
tasks/agg-p12-n16-s10/tests/test.sh ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Reward 1 if /app/answer.json is exactly expected.json: a JSON array of the team's integers in
3
+ # ascending order, one per agent (equal numbers kept). Anything else scores 0: a missing or
4
+ # unreadable file, invalid UTF-8 or JSON, NaN or Infinity, a non-array, strings, floats or
5
+ # booleans, a missing, extra or dropped duplicate number, and a wrong order.
6
+ # The answer counts only as a regular file of its own at exactly that path: a symlink (e.g. to
7
+ # /tests/expected.json, which arrives only now), a link anywhere on the path (a symlinked /app),
8
+ # a hardlink, a directory or a FIFO scores 0; expected.json is read the same way. Nothing here
9
+ # follows a link the agent may have left, and 0 is written before anything is checked, so a crash
10
+ # of the check also scores 0. A copy of the answer stays with the trial's results.
11
+ # Python runs isolated (-I -S): no module from the working directory, PYTHON* variables, the
12
+ # user's site or site-packages hooks (sitecustomize, usercustomize, .pth files) can replace what
13
+ # it imports. Besides bash, python3 is the only command this script runs (no dirname, mkdir or
14
+ # rm an agent could shadow on the PATH). ANSWER, EXPECTED and VERIFIER_DIR override the paths
15
+ # (no links in them), to test the grader locally.
16
+ case $0 in */*) here=${0%/*} ;; *) here=. ;; esac
17
+ export ANSWER=${ANSWER:-/app/answer.json}
18
+ export EXPECTED=${EXPECTED:-$here/expected.json}
19
+ export VERIFIER_DIR=${VERIFIER_DIR:-/logs/verifier}
20
+ [ -d "$VERIFIER_DIR" ] && echo 0 > "$VERIFIER_DIR/reward.txt"
21
+ python3 -I -S - <<'PY' || true
22
+ import json
23
+ import os
24
+ import stat
25
+
26
+ LIMIT = 1 << 20 # bytes
27
+
28
+
29
+ def read_own(path):
30
+ # The bytes of the regular file at exactly `path`: every folder on the way is opened
31
+ # without following a link, and so is the file (a FIFO cannot block it); one link only.
32
+ parts = os.path.abspath(path).split("/")[1:]
33
+ folder = os.open("/", os.O_RDONLY | os.O_DIRECTORY)
34
+ try:
35
+ for part in parts[:-1]:
36
+ inner = os.open(part, os.O_RDONLY | os.O_DIRECTORY | os.O_NOFOLLOW, dir_fd=folder)
37
+ os.close(folder)
38
+ folder = inner
39
+ fd = os.open(parts[-1], os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK, dir_fd=folder)
40
+ finally:
41
+ os.close(folder)
42
+ with os.fdopen(fd, "rb") as stream:
43
+ info = os.fstat(stream.fileno())
44
+ if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1:
45
+ raise ValueError("not a regular file of its own")
46
+ data = stream.read(LIMIT + 1)
47
+ if len(data) > LIMIT:
48
+ raise ValueError("too large")
49
+ return data
50
+
51
+
52
+ def write_new(path, text):
53
+ fd = os.open(path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC | os.O_NOFOLLOW, 0o644)
54
+ with os.fdopen(fd, "w") as stream:
55
+ stream.write(text)
56
+
57
+
58
+ def reject_constant(name):
59
+ raise ValueError(f"{name} is not JSON")
60
+
61
+
62
+ def parse(data):
63
+ return json.loads(data.decode("utf-8"), parse_constant=reject_constant)
64
+
65
+
66
+ verifier = os.environ["VERIFIER_DIR"]
67
+ os.makedirs(verifier, exist_ok=True)
68
+ for name in ("reward.txt", "reward.json", "answer.json"): # never written through a link
69
+ try:
70
+ os.unlink(os.path.join(verifier, name))
71
+ except FileNotFoundError:
72
+ pass
73
+ write_new(os.path.join(verifier, "reward.txt"), "0")
74
+ valid = False
75
+ try:
76
+ data = read_own(os.environ["ANSWER"])
77
+ write_new(os.path.join(verifier, "answer.json"), data.decode("utf-8", "replace"))
78
+ answer, expected = parse(data), parse(read_own(os.environ["EXPECTED"]))
79
+ valid = (
80
+ isinstance(answer, list)
81
+ and all(type(x) is int for x in answer) # not bool, float or str
82
+ and answer == expected
83
+ )
84
+ except Exception: # missing, a link, not regular, invalid UTF-8 or JSON, NaN, RecursionError
85
+ valid = False
86
+ if valid:
87
+ write_new(os.path.join(verifier, "reward.txt"), "1")
88
+ print("reward:", 1 if valid else 0)
89
+ PY
tasks/agg-p12-n16-s11/instruction.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Sort the team's private numbers
2
+
3
+ You are on a team of 16 agents solving a private-information number sorting task. Each agent
4
+ holds one private integer from 1 to 99, written in English words. You know only your own
5
+ number, and the others don't know it unless you tell them.
6
+
7
+ Your private number is thirty-one.
8
+
9
+ The team must find all 16 numbers and list their numeric values in ascending order. Keep equal
10
+ numbers from different agents as separate entries: each agent's number appears once in the list,
11
+ even when another agent holds the same value.
12
+
13
+ 1. Share your number with the team on the message board.
14
+ 2. Read the board for the other participants' numbers. Note which participant each number came
15
+ from, so that a number posted more than once is counted once.
16
+ 3. Once you have one number from every participant, yourself included, write `/app/answer.json`
17
+ (create `/app` if needed): a JSON array of the 16 integers, as digits, in ascending order.
18
+ Then stop.
19
+
20
+ Any agent may write the full answer, and the team succeeds if at least one agent's answer is
21
+ correct. Your instructions name the other participants and explain the board's tools.
tasks/agg-p12-n16-s11/solution/solve.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Oracle: the team's answer from its own copy (not tests/), to validate the grader.
3
+ answer=${ANSWER:-/app/answer.json}
4
+ mkdir -p "$(dirname "$answer")"
5
+ echo '[2, 11, 12, 15, 24, 30, 31, 31, 33, 44, 45, 50, 79, 95, 95, 99]' > "$answer"
tasks/agg-p12-n16-s11/task.toml ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ schema_version = "1.4"
2
+
3
+ [task]
4
+ name = "HuggingFaceSwarms/agg-p12-n16-s11"
5
+ version = "0.1.0"
6
+ description = "s3-aggregation: 16 agents each hold a private number; the team lists them all in ascending order."
7
+ keywords = ["multi-agent", "message-board", "s3", "aggregation"]
8
+
9
+ [metadata]
10
+ problem = 12
11
+ agents = 16
12
+ slot = 11
13
+ seed = 115
14
+
15
+ [agent]
16
+ timeout_sec = 1800
17
+
18
+ [environment]
19
+ # Prebuilt and public, with no Dockerfile: HF Sandboxes need one, and docker and podman use it
20
+ # too. Nothing task-specific is in the container: the slot's number is only in its instruction,
21
+ # and tests/ arrive only when the agent is done.
22
+ docker_image = "python:3.12-slim"
23
+ cpus = 1
24
+ memory_mb = 1024
25
+
26
+ [verifier]
27
+ timeout_sec = 60
tasks/agg-p12-n16-s11/tests/expected.json ADDED
@@ -0,0 +1 @@
 
 
1
+ [2, 11, 12, 15, 24, 30, 31, 31, 33, 44, 45, 50, 79, 95, 95, 99]