Skip to content

refactor(legal-agent-bench): migrate to the Harbor Environment Server - #5788

Closed
rystewart-nvidia wants to merge 23 commits into
NVIDIA-NeMo:mainfrom
rystewart-nvidia:lab-refresh/harbor
Closed

rystewart-nvidia wants to merge 23 commits into
NVIDIA-NeMo:mainfrom
rystewart-nvidia:lab-refresh/harbor

Conversation

@rystewart-nvidia

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

Copy link
Copy Markdown
Contributor

What does this PR do?

Run LAB through Gym's Harbor Environment Server (instead of the deprecated Harbor agent adapters). The Environment Server owns task setup, sandbox lifetime, output collection, verification, and cleanup. The LAB Native harness borrows the agent sandbox through Gym's existing session API.

Changes are limited to LAB code and documentation, apart from registering the native agent and extending its shared configuration test.

  • Remove the old Harbor agent and unused Chat Completions adapter package. The native harness calls Gym's model server directly.
  • Make LAB Native the default in config.yaml, with config_native.yaml available for explicit selection.
  • Convert legacy instance_id rows during preparation, preserving task IDs and caller parameters. Write canonical task rows and a digest-checked task mapping.
  • Give the agent access to documents and skills while keeping rubrics and judge credentials in a separate verifier sandbox.
  • Include setup time in the agent’s time limit. Infrastructure and cleanup failures are reported as errors rather than benchmark scores.
  • Save agent outputs, judge reports, and source/harness metadata. Report missing or failed grading as an error.

Update: This PR now depends on #5792. This PR will be rebased onto main after #5792 merges. This PR incorporates the native-agent work from #5968, which will be closed in favor of this PR.

Validation

All 547 LAB, native-agent, benchmark, shared configuration, manifest, and docs-link tests passed. Tests cover preparation and cache invalidation, literal tool arguments, borrowed-session cleanup, verifier isolation, deadlines, grading failures, and trusted metadata. 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 --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

Shared configuration and manifest checks:

PYTHONPATH=. LITELLM_LOCAL_MODEL_COST_MAP=True uv run --active --no-sync python -m pytest \
  tests/unit_tests/config/test_global_config.py \
  tests/unit_tests/environment/test_environment_manifest.py \
  tests/unit_tests/test_fern_docs_links.py -q

Rollouts

The trust-document example ran through the Environment Server and Docker with GPT-5.6-sol as policy and GPT-5.5 as judge. It produced the requested DOCX, passed 23/23 criteria, and received reward 1, with no judge errors. This used the retained source pin and single-judge scoring. A short OpenShell run also passed staging, execution, separate verification, output collection, and cleanup.

To reproduce:

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_model_name: gpt-5.5
judge_base_url: https://your-judge-gateway.example/v1
judge_api_key: your-judge-key

Using the activated environment from Validation, prepare and run 1 example task:

mkdir -p results/lab-smoke
head -n 1 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_native.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 1 --concurrency 1

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

Compatibility and benchmark impact

The Harvey LAB task source is still pinned to commit f46ef86e4788545622db25dcffa3aebb7a139929, with 1,749 tasks and the existing prompt, tools, and single-judge scoring. This will be updated in a subsequent commit (#5791). The LAB Native harness is now the default through config.yaml and config_native.yaml. The policy output-token default is 65,536. Changing execution paths or token budgets can affect scores.

Prepare legacy rows before running them. Keep the generated JSONL and its .tasksets.json mapping together. As with shared Harbor preparation, finish preparation before starting servers; use separate output paths for concurrent runs with different task selections. Replace old Harbor job and LAB Resources overrides with Environment Server settings; the agent name is legal_agent_bench_benchmark_agent.

Sandbox selection uses Gym's sandbox config and the shared Environment Server's provider restrictions. Automatic image building requires Docker. With another sandbox backend, supplying a prepared, provider-compatible tools image avoids needing Docker locally. Preparation storage must support hardlinks and cross-process flock; noflock and localflock shared mounts are unsupported.

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 7, 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 7, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added feature New capabilities, enhancements, or enablement work area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers needs-review PR is ready for code review and waiting on a reviewer labels Nov 7, 2026
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Nov 9, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Nov 9, 2026
@cmunley1

Copy link
Copy Markdown
Contributor

This moves LAB onto responses_api_agents/harbor_agent_general, which now logs at startup that it is deprecated in favor of the Harbor environment server (environment_servers/harbor, see its README). Could LAB target environment_servers/harbor directly, so it doesn't need a second migration later? If not, a note in the PR body on the plan would help.

@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-maintainers Waiting on maintainers to respond label Nov 12, 2026
@rystewart-nvidia rystewart-nvidia changed the title refactor(legal-agent-bench): migrate to the general Harbor bridge refactor(legal-agent-bench): migrate to the Harbor Environment Server Nov 12, 2026
@rystewart-nvidia

Copy link
Copy Markdown
Contributor Author

@cmunley1 updated this PR to have LAB to use environment_servers/harbor directly, and removed the deprecated Harbor agent integration. Also updated the PR description and title accordingly

cmunley1
cmunley1 previously approved these changes Nov 13, 2026
@github-actions github-actions Bot removed the sla:triage-overdue Review assignment is over the one-business-day SLA 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

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

Copy link
Copy Markdown
Contributor Author

superseded by changes merged in #5791, closing

@nemo-automation-bot nemo-automation-bot Bot removed the community-request Issue reported or requested by someone from the community label Nov 27, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-maintainers Waiting on maintainers to respond label Nov 27, 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 feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer risk:high Autobot PR risk: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants