Skip to main content
HUD’s coding example is a complete repository environment: the agent works in a sandboxed ssh workspace while the environment keeps a clean baseline outside it, then applies the authored tests after the agent finishes. hud init --template coding copies the project as a starting point.

Create the environment

The generated project contains: The included flask-4992 and flask-5063 tasks are from SWE-bench Lite. Run them with any coding agent that opens the environment’s shell capability:
Local non-root runs require usable Linux bwrap isolation. Otherwise, build the packaged environment and attach to its control channel:
HUD’s seccomp profile and system-path settings allow bubblewrap to create the Workspace namespaces inside Docker without disabling seccomp. The host must allow unprivileged user namespaces; the environment refuses to start if the runtime blocks them.

How the grading boundary works

  1. Task setup clones base_ref into an environment-owned baseline outside the workspace.
  2. The clean worktree is copied into the ssh workspace and initialized as a one-commit repository, so the source history and reference-fix refs are never exposed to the agent.
  3. Grading terminates the agent’s isolated session namespace and discards its Git metadata.
  4. The environment restores test_path to the baseline and applies the hidden patch.
  5. The custom JUnitGrader runs test_command through BashGrader under the workspace’s isolated UID, then scores the selected fail-to-pass and pass-to-pass test IDs.
This keeps the deliverable as repository state rather than a text answer, while preventing the agent from weakening the grader or reading the reference fix.

Define a task

Call coding_task once per repository issue and give the resulting task a stable slug:
tasks.py
test_command runs from the repository root and must write JUnit XML to {junit_path}. The default reward is the fraction of selected tests that pass; set binary=True to require every selected test.

Adapt it to another repository

  • Replace flask.bundle with a bundle containing the prepared baselines for your tasks.
  • Update REPO_SOURCE in env.py, or set REPO_URL for a local run.
  • Install repository dependencies in Dockerfile.hud so grading does not depend on runtime downloads.
  • Keep reference fixes outside the baseline history exposed to the agent; put hidden test patches in the task rows.
  • Add task rows in tasks.py; changing rows does not require changing the environment template.
The complete source lives in environments/coding.

See also

Capabilities

Graders

Designing tasks for signal