Skip to content

feat(legal-agent-bench): support configurable agent harnesses - #5990

Merged
athitten merged 41 commits into
NVIDIA-NeMo:mainfrom
rystewart-nvidia:lab-refresh/harnesses
Nov 24, 2026
Merged

athitten merged 41 commits into
NVIDIA-NeMo:mainfrom
rystewart-nvidia:lab-refresh/harnesses

Conversation

@rystewart-nvidia

@rystewart-nvidia rystewart-nvidia commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Add Hermes, Claude Code, and Codex presets for comparing harnesses on the same LAB tasks. Depends on #5791. This PR will be rebased onto main after 5791 merges.

  • Add ability to easily switch harnesses by changing the preset config path. Share task selection, single or dual judging, scoring mode, time budgets, and concurrency settings.
  • Reuse Gym's existing harness adapters and the Harbor Environment Server for setup, output collection, grading, and sandbox cleanup.
  • Apply shared sampling defaults without overwriting supported task-row values. Each harness retains its own tools, turn limits, and completion rules.
  • Keep LAB Native as the default. Document shared or separate judge endpoints and keys, plus independent sandbox selection.

No shared runtime changes are needed in this PR.

Validation

All LAB, native-agent, benchmark, and docs-link tests passed. All-files pre-commit, import checks, and Fern validation passed.

uv sync --locked --project resources_servers/legal_agent_bench
source resources_servers/legal_agent_bench/.venv/bin/activate
PYTHONPATH=. LITELLM_LOCAL_MODEL_COST_MAP=True uv run --active --no-sync python -m pytest \
  resources_servers/legal_agent_bench/tests \
  responses_api_agents/legal_agent_bench_native/tests \
  benchmarks/legal_agent_bench/tests \
  tests/unit_tests/test_fern_docs_links.py --import-mode=importlib -q

LITELLM_LOCAL_MODEL_COST_MAP=True avoids downloading model prices during imports; --active --no-sync uses the activated environment.

pre-commit run --all-files
git diff --check
(cd fern && npm run check)

Rollouts

All four harnesses ran two example tasks through the Environment Server using Docker sandbox backend with GPT-5.6-sol as the policy model. All eight runs produced their requested DOCX and complete reports from Claude Sonnet 4.6 and GPT-5.5, with no judge errors.

Harness Task Claude Sonnet 4.6 GPT-5.5 Reward
LAB Native Trust documents 21/23 22/23 0
LAB Native TSA markup 63/75 64/75 0
Hermes Trust documents 21/23 22/23 0
Hermes TSA markup 58/75 56/75 0
Claude Code Trust documents 21/23 22/23 0
Claude Code TSA markup 70/75 71/75 0
Codex Trust documents 23/23 23/23 1
Codex TSA markup 65/75 64/75 0

All four harnesses passed short model-driven checks on Enroot, Apptainer, OpenSandbox, and OpenShell. These checked public inputs, output collection, separate verifier files and secrets, and cleanup; they were not additional legal-task comparisons. LocalEmu covered Fargate lifecycle and file transfers but real AWS provisioning and end-to-end harness runs on AWS Fargate have not been verified.

With Docker running, add policy_base_url, policy_api_key, and policy_model_name to the gitignored root env.yaml, plus the judge settings below. Use the model IDs accepted by your endpoints. Set default_host in env.yaml to the host address that the sandboxes can reach.

judge_base_url: https://your-judge-gateway.example/v1
judge_api_key: your-judge-key
lab_judges:
  - model_name: claude-sonnet-4-6
  - model_name: gpt-5.5

Alternatively, configure each judge separately in env.yaml. Use the model IDs accepted by each OpenAI-compatible endpoint:

lab_judges:
  - model_name: claude-sonnet-4-6
    base_url: https://your-claude-gateway.example/v1
    api_key: your-claude-key
  - model_name: gpt-5.5
    base_url: https://your-openai-gateway.example/v1
    api_key: your-openai-key

Per-judge values override the shared settings. Keep one entry for single judging.

Using the activated environment from Validation, prepare and run 2 example tasks:

mkdir -p results/lab-smoke
head -n 2 resources_servers/legal_agent_bench/data/example.jsonl > results/lab-smoke/selected.jsonl
cat > results/lab-smoke/config.yaml <<'YAML'
config_paths:
  - benchmarks/legal_agent_bench/config_hermes.yaml
  - responses_api_models/openai_model/configs/openai_model.yaml
  - benchmarks/legal_agent_bench/model_sampling_openai.yaml
  - nemo_gym/sandbox/providers/docker/configs/docker.yaml
use_absolute_ip: true
num_samples_in_parallel: 1
prepare_script_args:
  input: results/lab-smoke/selected.jsonl
  output: results/lab-smoke/prepared.jsonl
lab:
  agent_timeout_seconds: 1200
  verifier_timeout_seconds: 900
  judge_parallelism: 2
legal_agent_bench_environment_server:
  environment_servers:
    harbor:
      artifacts_dir: results/lab-smoke/artifacts
YAML
uv run --active --no-sync gym eval prepare --config results/lab-smoke/config.yaml
uv run --active --no-sync gym env start --config results/lab-smoke/config.yaml

In another terminal with the same environment activated:

uv run --active --no-sync gym eval run --no-serve \
  --config results/lab-smoke/config.yaml \
  --input results/lab-smoke/prepared.jsonl \
  --output results/lab-smoke/rollouts.jsonl --limit 2 --concurrency 1

Inspect the rollout rows and the outputs and judge reports under results/lab-smoke/artifacts. Stop the servers after collection. Scores and completion can vary; these commands use a twenty-minute agent budget.

Change the preset in results/lab-smoke/config.yaml to select another harness:

Preset under benchmarks/legal_agent_bench/ Harness
config.yaml, config_native.yaml LAB Native
config_hermes.yaml Hermes
config_claude_code.yaml Claude Code
config_codex.yaml Codex

Stop the current servers before changing presets. Use a different results directory for each harness to retain the comparison outputs.

Compatibility and benchmark impact

All four harnesses use legal_agent_bench_benchmark_agent, canonical task rows, the same verifier, and the Harbor Environment Server.

Select Docker, ECS Fargate, Apptainer, Enroot, OpenSandbox, or OpenShell through the sandbox provider config, subject to the Harbor Environment Server's capabilities. Automatic LAB image building needs Docker; running another backend with a prepared compatible image does not need Docker. OpenShell policies must allow writes to /workspace, /tmp, /home/sandbox, /tests, and /logs.

Hermes rejects row-level top_p; Codex rejects row-level temperature and top_p. Use the shared model sampling config for those comparisons.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Documentation added or updated, or N/A with justification.
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format checks pass).
  • New source files include the required Apache-2.0 SPDX header.
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

@copy-pr-bot

copy-pr-bot Bot commented Nov 11, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@nemo-automation-bot nemo-automation-bot Bot added the community-request Issue reported or requested by someone from the community label Nov 11, 2026
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Nov 12, 2026
@rystewart-nvidia
rystewart-nvidia force-pushed the lab-refresh/harnesses branch 2 times, most recently from f202491 to edf3a73 Compare November 12, 2026 20:34
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Nov 13, 2026
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 13, 2026 15:57
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Co-authored-by: Abhishree Thittenamane <[email protected]>
Signed-off-by: rystewart-nvidia <[email protected]>
@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 20, 2026 20:09
athitten
athitten previously approved these changes Nov 21, 2026

@athitten athitten left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the comments @rystewart-nvidia ! Please lmk once updated with latest main after 5791 gets merged, will re-approve.

Signed-off-by: Ryan Stewart <[email protected]>
@rystewart-nvidia

rystewart-nvidia commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor Author

@athitten merged main including 5791, tests and pre-commit pass, should be good to go. Thanks!

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Nov 23, 2026
@athitten
athitten added this pull request to the merge queue Nov 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/45317042725

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 24, 2026
@athitten
athitten added this pull request to the merge queue Nov 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/45319718525

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 24, 2026
@athitten
athitten added this pull request to the merge queue Nov 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/45336593491

Merged via the queue into NVIDIA-NeMo:main with commit 8629d52 Nov 24, 2026
69 checks passed
@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-maintainers Waiting on maintainers to respond label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers blocked Work cannot move forward until an external dependency is cleared feature New capabilities, enhancements, or enablement work risk:high Autobot PR risk: high sla:review-overdue Review response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants