kosa8 cloud sandbox grade
Grade a sandbox in a sealed fork: hidden files, no network, a reward
Usage#
kosa8 cloud sandbox grade ID [--file LOCAL:/PATH ...] -- COMMAND [ARG...]
Forks one copy of the solved sandbox, takes its network away, writes the --file files there (hidden tests the solver never sees), runs the command and reads the reward, then deletes the copy (--keep keeps it an hour).
The reward is the last line of stdout that is a JSON object with a number "reward" (and optional "metrics"), e.g. {"reward": 0.75}; without one, exit 0 is 1.0 and any other exit 0.0. The failure class says why it did not pass: ok, exit_nonzero, timeout, infra, quota or client. An infra failure has no reward: mask it and retry rather than scoring it 0.
--run records the graded rollout on that RL run (kosa8 cloud rl runs get RUN).
Options#
| Flag | Type | What it does | Default |
|---|---|---|---|
-e, --env | stringArray | set a variable for the command, NAME=value or NAME for this shell's value (repeatable) | [] |
--env-file | stringArray | read NAME=value lines from this file (- for stdin; repeatable) | [] |
-f, --file | stringArray | write this local file into the grader at an absolute path, LOCAL:/PATH (repeatable, 8 MiB in all) | [] |
--group | string | with --run: the rollout's group (e.g. the prompt's id) | — |
--index | int | with --run: the rollout's index in its group | 0 |
--keep | bool | keep the grader copy (an hour) to look into it | — |
--output | bool | print the command's stdout and stderr (their last 64 KiB) too | — |
--run | string | record the graded rollout on this RL run (run_…) | — |
--step | int | with --run: the training step of this rollout | 0 |
--timeout | duration | stop the command after this long, 1s to 90s (default: the API's) | 0s |
Example#
kosa8 cloud sandbox grade sbx_abc --file tests/test_hidden.py:/grader/test_hidden.py -- pytest -q /grader/test_hidden.py kosa8 cloud sandbox grade sbx_abc --run run_8f2k --step 12 --file grade.py:/grader/grade.py -- python3 /grader/grade.py kosa8 cloud sandbox grade sbx_abc --json -- ./score.sh | jq .reward