nemo_gym.verifier_utils.sandbox_verification
nemo_gym.verifier_utils.sandbox_verification
Run a verifier’s grading harness in a fresh, single-use provider sandbox.
A resources server uploads its runner and harness files with a JSON request; inside the
sandbox sandbox_runner.py request.json result.json grades the submission and writes a
result file, which is downloaded and parsed before the sandbox is stopped. Only the
provider-neutral sandbox API is used, so any provider works.
Submission failures (wrong answer, timeout, crash) are the harness’s to report in the
result. A failure of the sandbox or the runner raises SandboxVerificationError with a
failure_kind so the caller can mask the sample instead of scoring it zero.
Module Contents
Classes
Functions
Data
API
Bases: BaseModel
Sandbox settings for grading one submission per sandbox.
Bases: Exception
The sandbox or runner failed, so the sample has no valid reward.
Grade one submission in a fresh sandbox and return the parsed result.
Parameters:
Mapping[str, Any] | SandboxProvider — Provider instance or provider config mapping.
SandboxVerificationConfig — Image, resources and provider settings.
Text files to upload, keyed by path relative to work_dir. Must include
sandbox_runner.py, which is run as sandbox_runner.py request.json result.json.
JSON-serializable request written to request.json. It stays in the runner’s
working directory, so anything the runner launches can read it: keep expected outputs
out of it or delete it before running the submission.
Deadline for the runner.
Callable[[str], T ] — Parses and validates the text of result.json. Any exception it raises
is reported as a verifier_error.
Sandbox metadata; config.metadata entries win on conflicts.
Absolute directory in the sandbox; each call uses its own subdirectory of it for the uploaded files and the result.
Raises:
SandboxVerificationError:provider_unavailableif the sandbox could not start,verifier_errorif the runner failed or its result is invalid.