Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions harvey-labs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Harbor writes run output here (jobs_dir in config.yaml).
jobs/

# Ad-hoc run output from `harbor run -o results/`.
results/

.env
__pycache__/
*.pyc
21 changes: 21 additions & 0 deletions harvey-labs/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Harvey AI

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
71 changes: 71 additions & 0 deletions harvey-labs/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
Harvey's Legal Agent Benchmark (LAB) — Kaggle / Harbor port
=========================================================

This directory is a derivative work of Harvey's Legal Agent Benchmark (LAB):

https://github.com/harveyai/harvey-labs
Copyright (c) 2026 Harvey AI
Licensed under the MIT License (see ./LICENSE)

The upstream project is the original source of the benchmark tasks, the agent
scaffolding, the rubric criteria, and the evaluation methodology. This port
adapts that work to run on Kaggle via the Harbor framework
(https://github.com/laude-institute/harbor). Main architectural changes:
replacing `podman` sandbox with Harbor-managed containers and routing all
model traffic through Kaggle's ModelProxy instead of vendor APIs.

Upstream reference commit: 55510f0e609ffa5cf6f5df17d9a813ce4bb33d0c


Verbatim copies from harvey-labs (MIT, (c) 2026 Harvey AI)
----------------------------------------------------------

LICENSE
<- LICENSE

agents/lab_harness/assets/system_prompt.md
<- harness/system_prompt.md

agents/lab_harness/assets/skills/{docx,pptx,xlsx}/
<- harness/skills/{docx,pptx,xlsx}/

tasks/**/tests/rubric_criterion.txt
<- evaluation/prompts/rubric_criterion.txt

tasks/**/task.json
<- the `instructions` field of the same task.json
is used for tasks/**/instruction.md (Harbor format)

tasks/**/environment/documents/

tasks/**/environment/parse_doc.py
<- sandbox/parsers/parse_doc.py


Derived / reimplemented from harvey-labs
-----------------------------------------

These files are new code written for the Harbor port, but their behavior is
deliberately modeled on the upstream implementation so that scores remain
comparable to any published Harvey LAB results:

agents/lab_harness/agent.py <- harness/run.py (prompt assembly, run wiring)
agents/lab_harness/loop.py <- harness/agent_loop.py
agents/lab_harness/tools.py <- harness/tools.py
agents/lab_harness/adapters/ <- harness/adapters/
tasks/**/tests/judge.py <- evaluation/judge.py, evaluation/scoring.py,
evaluation/run_eval.py (dual-judge
aggregation, JUDGE_MODELS),
evaluation/report.py (strict-AND merged
per-criterion view)
tasks/**/environment/Dockerfile <- sandbox/Dockerfile

Known intentional deviations from upstream are documented in README.md.


Kaggle-authored additions
--------------------------

Files in this directory that are not copied from or derived from harvey-labs
are contributed by Google LLC under the Apache License, Version 2.0, matching
the license of the containing repository (see ../LICENSE).
300 changes: 300 additions & 0 deletions harvey-labs/README.md

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions harvey-labs/agents/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Harbor agents for the Harvey LAB port.

This is the top-level package Harbor resolves `--agent agents.<name>:<Class>`
against; the Kaggle entrypoint puts the repo root on PYTHONPATH for
custom-import agents.
"""
24 changes: 24 additions & 0 deletions harvey-labs/agents/lab_harness/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Harvey LAB reference harness, ported to a Harbor external agent.

Run with:
harbor run -p <task-dir> --agent agents.lab_harness:LABHarnessAgent \
--model anthropic/claude-sonnet-4-6
"""

from .agent import LABHarnessAgent

__all__ = ["LABHarnessAgent"]
95 changes: 95 additions & 0 deletions harvey-labs/agents/lab_harness/adapters/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Adapter registry.

Maps a Harbor model name onto a provider adapter and the ModelProxy path that
serves it. Only Anthropic is wired up today; OpenAI (`/openapi`) and Google
(`/gemini`) adapters slot in here without touching the agent loop.
"""

from .base import ModelAdapter, ModelResponse, ToolCall

__all__ = ["ModelAdapter", "ModelResponse", "ToolCall", "create_adapter"]

# provider -> ModelProxy path suffix. See
# experimental/harbor/harbor-base/entrypoint-common.sh for the canonical map.
_PROXY_PATHS = {
"anthropic": "anthropic",
"openai": "openapi",
"google": "gemini",
}

_SUPPORTED = ("anthropic",)


def split_model_name(model_name: str) -> tuple[str, str]:
"""Split a Harbor model name into (provider, model).

Harbor passes provider-prefixed names such as
``anthropic/claude-sonnet-4-6``. An unprefixed name is inferred from the
model id so that ``claude-sonnet-4-6`` also works.
"""
if "/" in model_name:
provider, _, model = model_name.partition("/")
return provider.lower(), model

lowered = model_name.lower()
if lowered.startswith("claude"):
return "anthropic", model_name
if lowered.startswith(("gpt", "o1", "o3", "o4")):
return "openai", model_name
if lowered.startswith("gemini"):
return "google", model_name
raise ValueError(
f"Cannot infer a provider from model name {model_name!r}. "
"Pass a provider-prefixed name such as 'anthropic/claude-sonnet-4-6'."
)


def create_adapter(
model_name: str,
proxy_base_url: str,
api_key: str,
temperature: float = 0.0,
reasoning_effort: str | None = None,
) -> ModelAdapter:
"""Build the adapter for ``model_name``, pointed at ModelProxy.

Args:
model_name: Harbor model name, e.g. ``anthropic/claude-sonnet-4-6``.
proxy_base_url: ModelProxy root, e.g. ``https://mp-staging.kaggle.net/models``.
api_key: MODEL_PROXY_API_KEY, sent as a bearer token.
"""
provider, model = split_model_name(model_name)

if provider not in _SUPPORTED:
known = ", ".join(sorted(_PROXY_PATHS))
raise ValueError(
f"Provider {provider!r} is not supported yet. This port currently "
f"implements: {', '.join(_SUPPORTED)}. "
f"(Recognized providers, pending adapters: {known}.)"
)

base_url = f"{proxy_base_url.rstrip('/')}/{_PROXY_PATHS[provider]}"

from .anthropic_adapter import AnthropicAdapter

return AnthropicAdapter(
model=model,
base_url=base_url,
api_key=api_key,
temperature=temperature,
reasoning_effort=reasoning_effort,
)
Loading