From 4226ed36adeac60d452639c107b9944d82d039e6 Mon Sep 17 00:00:00 2001 From: Albert Zhao Date: Fri, 20 Nov 2026 10:38:59 -0500 Subject: [PATCH] Use current module paths for migrated imports --- docs/_examples/first_model/judge.py | 3 ++- docs/_examples/first_model/pipeline.py | 2 +- docs/_examples/first_training/judge.py | 3 ++- docs/_examples/first_training/pipeline.py | 2 +- docs/_examples/interface_task/judge.py | 3 ++- docs/_examples/interface_task/pipeline.py | 2 +- docs/_examples/mini_swe_agent/judge.py | 3 ++- docs/framework/agent-layers.md | 4 +++- examples/agentdojo/utils/tests/test_replay.py | 2 +- examples/agentdyn/utils/bridge.py | 3 ++- .../aspire_robosuite/utils/agent/agent.py | 2 +- .../utils/benchmark/judge.py | 3 ++- .../clbench_database/utils/agent/agent.py | 2 +- examples/clbench_poker/utils/agent/agent.py | 2 +- examples/officeqa/ahe_adapter/trials.py | 2 +- examples/officeqa/utils/agent/agent.py | 2 +- examples/servelearnbench/utils/agent/agent.py | 2 +- hermit/agent/acting/workspace.py | 4 ++-- hermit/agent/base/cli.py | 4 ++-- hermit/agent/base/endpoint.py | 2 +- hermit/agent/base/react.py | 5 +++-- .../evolver/methods/ahe_adapter/debugger.py | 4 ++-- hermit/isolate.py | 3 ++- hermit/settings_check.py | 3 ++- hermit/worker.py | 6 ++++-- tests/core/test_agents.py | 2 +- tests/core/test_base_agents.py | 4 ++-- tests/core/test_claude_subscription.py | 4 ++-- tests/core/test_cli_agent.py | 3 +-- tests/core/test_dsh_agent.py | 8 ++++---- tests/core/test_environment.py | 4 ++-- tests/core/test_hermes_agent.py | 4 ++-- tests/core/test_isolate.py | 20 +++++++++---------- tests/core/test_mini_swe_agent.py | 4 ++-- tests/core/test_opencode_agent.py | 4 ++-- tests/core/test_pi_agent.py | 4 ++-- tests/core/test_task_directory.py | 6 +++--- tests/methods/ace/test_ace.py | 2 +- tests/methods/ahe/test_ahe_adapter_example.py | 3 ++- tests/methods/ahe/test_ahe_evolver.py | 2 +- tests/methods/ahe/test_ahe_on_claude.py | 2 +- tests/methods/evosafe/test_agentdyn.py | 4 ++-- tests/methods/evosafe/test_agentdyn_compat.py | 2 +- .../evosafe/test_agentdyn_live_backends.py | 2 +- tests/methods/evosafe/test_agentdyn_review.py | 3 ++- tests/methods/evosafe/test_evosafe_on_pi.py | 2 +- tests/methods/mwm/test_mwm_evolver.py | 2 +- tests/methods/opro/test_opro.py | 2 +- .../optimizers/test_optimizer_evolvers.py | 2 +- tests/methods/reharness/test_reharness.py | 2 +- tests/methods/she/test_agentdyn_she.py | 2 +- tests/toy_task.py | 2 +- 52 files changed, 94 insertions(+), 80 deletions(-) diff --git a/docs/_examples/first_model/judge.py b/docs/_examples/first_model/judge.py index e88423e5..8a2f0658 100644 --- a/docs/_examples/first_model/judge.py +++ b/docs/_examples/first_model/judge.py @@ -1,7 +1,8 @@ """Private labels are kept in the judge, outside learner-visible task rows.""" import json -from hermit.task import JudgeResult, RunOutput +from hermit.task import JudgeResult +from hermit.common import RunOutput LABELS = { "train-001": "positive", diff --git a/docs/_examples/first_model/pipeline.py b/docs/_examples/first_model/pipeline.py index 77aa8a23..877d19db 100644 --- a/docs/_examples/first_model/pipeline.py +++ b/docs/_examples/first_model/pipeline.py @@ -4,7 +4,7 @@ from hermit import Session from hermit.agent.model.llm import ChatClient -from hermit.task import RunOutput +from hermit.common import RunOutput def run(task: dict, adapter: Path | None) -> RunOutput: diff --git a/docs/_examples/first_training/judge.py b/docs/_examples/first_training/judge.py index ec60d0a5..4231d1ee 100644 --- a/docs/_examples/first_training/judge.py +++ b/docs/_examples/first_training/judge.py @@ -1,5 +1,6 @@ """Compute the target privately rather than placing answers in task rows.""" -from hermit.task import JudgeResult, RunOutput +from hermit.task import JudgeResult +from hermit.common import RunOutput def score(task: dict, output: RunOutput) -> JudgeResult: diff --git a/docs/_examples/first_training/pipeline.py b/docs/_examples/first_training/pipeline.py index 83d8919a..7441260a 100644 --- a/docs/_examples/first_training/pipeline.py +++ b/docs/_examples/first_training/pipeline.py @@ -1,7 +1,7 @@ """A deterministic teaching agent that interprets one adapter rule.""" from pathlib import Path from hermit import Session -from hermit.task import RunOutput +from hermit.common import RunOutput def run(task: dict, adapter: Path | None) -> RunOutput: diff --git a/docs/_examples/interface_task/judge.py b/docs/_examples/interface_task/judge.py index 15ba6262..8282f20a 100644 --- a/docs/_examples/interface_task/judge.py +++ b/docs/_examples/interface_task/judge.py @@ -1,5 +1,6 @@ """Scores the offline echo task.""" -from hermit.task import JudgeResult, RunOutput +from hermit.task import JudgeResult +from hermit.common import RunOutput def score(task: dict, output: RunOutput) -> JudgeResult: diff --git a/docs/_examples/interface_task/pipeline.py b/docs/_examples/interface_task/pipeline.py index ee8b3ed6..cf95e9e2 100644 --- a/docs/_examples/interface_task/pipeline.py +++ b/docs/_examples/interface_task/pipeline.py @@ -2,7 +2,7 @@ from pathlib import Path from hermit import Session -from hermit.task import RunOutput +from hermit.common import RunOutput def run(task: dict, adapter: Path | None) -> RunOutput: diff --git a/docs/_examples/mini_swe_agent/judge.py b/docs/_examples/mini_swe_agent/judge.py index 07729b85..ab3f417e 100644 --- a/docs/_examples/mini_swe_agent/judge.py +++ b/docs/_examples/mini_swe_agent/judge.py @@ -1,7 +1,8 @@ """Private answers are kept in the judge, outside learner-visible task rows.""" import json -from hermit.task import JudgeResult, RunOutput +from hermit.task import JudgeResult +from hermit.common import RunOutput ANSWERS = { "train-001": 195, diff --git a/docs/framework/agent-layers.md b/docs/framework/agent-layers.md index 364713aa..d209969f 100644 --- a/docs/framework/agent-layers.md +++ b/docs/framework/agent-layers.md @@ -334,6 +334,8 @@ Configurations that name an agent, an Evolver or a template (`agent.name: codex` | `make("direct", settings, model)`, `hermit.agent.base.direct` | `Direct(settings, model)`, `hermit.agent.model.direct` (Layer 1); `make("direct")` is refused; the old module path forwards for one release | | `hermit.agent.base.container` | `hermit.environment.docker` (the old path forwards for one release) | | `agent.name: harbor` (Hermit's agents injected into `harbor run`) | Codex, Claude Code, `answer`, `react` or a custom agent that takes the `environment` argument, in the task's Harbor environment (`environment.harbor`; Pi, OpenCode, dsh, mini-swe-agent and Hermes refuse it), verified by Harbor's verifier (`judge: {path: hermit.task.verify, name: environment}`) | -| `Mount`, `Limits` from `hermit.agent.base.interface` | `hermit.environment` (still importable from the interface) | +| `Environment`, `Mount`, `Limits`, `Unsupported`, `as_environment` from `hermit.agent.base.interface` | `hermit.environment` (still importable from the interface) | +| `as_messages` from `hermit.agent.base.interface` | `hermit.agent.model.direct` (still importable from the interface) | +| `RunOutput`, `load_callable` from `hermit.task` | `hermit.common` (still importable from `hermit.task`) | | a benchmark's own copy of the tool loop | a `ReactAgent` subclass with `@tool` methods and hooks | | `@tool(description, parameters)` | also `@tool` alone: the description from the docstring, the schema from the signature | diff --git a/examples/agentdojo/utils/tests/test_replay.py b/examples/agentdojo/utils/tests/test_replay.py index c349b0e8..5ad01439 100644 --- a/examples/agentdojo/utils/tests/test_replay.py +++ b/examples/agentdojo/utils/tests/test_replay.py @@ -17,7 +17,7 @@ import pytest from hermit.agent.acting import load_agent -from hermit.task import load_callable +from hermit.common import load_callable ROOT = Path(__file__).resolve().parents[4] UTILS = ROOT / 'examples/agentdojo/utils' diff --git a/examples/agentdyn/utils/bridge.py b/examples/agentdyn/utils/bridge.py index 69eaad38..061ff7d5 100644 --- a/examples/agentdyn/utils/bridge.py +++ b/examples/agentdyn/utils/bridge.py @@ -17,7 +17,8 @@ import time import uuid -from hermit.task import JudgeResult, RunOutput +from hermit.task import JudgeResult +from hermit.common import RunOutput from hermit.agent.evolver.methods.evosafe.hooks import ToolCallContext, ToolCallResult # The sibling modules (victim, auditor) are imported by file name, however this file was loaded. diff --git a/examples/aspire_robosuite/utils/agent/agent.py b/examples/aspire_robosuite/utils/agent/agent.py index b942cd73..46bfb976 100644 --- a/examples/aspire_robosuite/utils/agent/agent.py +++ b/examples/aspire_robosuite/utils/agent/agent.py @@ -30,7 +30,7 @@ import time from hermit.agent.acting import Agent -from hermit.task import RunOutput +from hermit.common import RunOutput HERE = Path(__file__).resolve().parent sys.path.insert(0, str(HERE)) diff --git a/examples/claude_subscription/utils/benchmark/judge.py b/examples/claude_subscription/utils/benchmark/judge.py index e88423e5..8a2f0658 100644 --- a/examples/claude_subscription/utils/benchmark/judge.py +++ b/examples/claude_subscription/utils/benchmark/judge.py @@ -1,7 +1,8 @@ """Private labels are kept in the judge, outside learner-visible task rows.""" import json -from hermit.task import JudgeResult, RunOutput +from hermit.task import JudgeResult +from hermit.common import RunOutput LABELS = { "train-001": "positive", diff --git a/examples/clbench_database/utils/agent/agent.py b/examples/clbench_database/utils/agent/agent.py index fc6865cb..035abeb9 100644 --- a/examples/clbench_database/utils/agent/agent.py +++ b/examples/clbench_database/utils/agent/agent.py @@ -10,7 +10,7 @@ import sys from hermit.agent.acting import Agent -from hermit.task import RunOutput +from hermit.common import RunOutput sys.path.insert(0, str(Path(__file__).resolve().parent)) from clbench_host import run_host # noqa: E402 diff --git a/examples/clbench_poker/utils/agent/agent.py b/examples/clbench_poker/utils/agent/agent.py index bef0d9ef..f499aca3 100644 --- a/examples/clbench_poker/utils/agent/agent.py +++ b/examples/clbench_poker/utils/agent/agent.py @@ -10,7 +10,7 @@ import sys from hermit.agent.acting import Agent -from hermit.task import RunOutput +from hermit.common import RunOutput sys.path.insert(0, str(Path(__file__).resolve().parent)) from clbench_host import run_host # noqa: E402 diff --git a/examples/officeqa/ahe_adapter/trials.py b/examples/officeqa/ahe_adapter/trials.py index af5f6ca2..d275a143 100644 --- a/examples/officeqa/ahe_adapter/trials.py +++ b/examples/officeqa/ahe_adapter/trials.py @@ -21,7 +21,7 @@ from pathlib import Path import shutil -from hermit.task import load_callable +from hermit.common import load_callable UTILS = Path(__file__).resolve().parent.parent / "utils" HOOK_LOGS = ".hermit-hooks" # the hook runner's log base under the session's workspace diff --git a/examples/officeqa/utils/agent/agent.py b/examples/officeqa/utils/agent/agent.py index bc5d0df5..0ffe2719 100644 --- a/examples/officeqa/utils/agent/agent.py +++ b/examples/officeqa/utils/agent/agent.py @@ -25,7 +25,7 @@ import types from hermit.agent.acting import Agent -from hermit.task import RunOutput +from hermit.common import RunOutput from officeqa_fields import officeqa_task # beside this file (load_callable puts its folder on the path) HERE = Path(__file__).resolve().parent diff --git a/examples/servelearnbench/utils/agent/agent.py b/examples/servelearnbench/utils/agent/agent.py index af496e1e..9ac44ca5 100644 --- a/examples/servelearnbench/utils/agent/agent.py +++ b/examples/servelearnbench/utils/agent/agent.py @@ -30,7 +30,7 @@ from hermit import Session from hermit.agent.acting import Agent -from hermit.task import RunOutput +from hermit.common import RunOutput HERE = Path(__file__).resolve().parent diff --git a/hermit/agent/acting/workspace.py b/hermit/agent/acting/workspace.py index 106558d7..472da5fd 100644 --- a/hermit/agent/acting/workspace.py +++ b/hermit/agent/acting/workspace.py @@ -79,8 +79,8 @@ import uuid from hermit.agent.acting.agent import ALL, Agent -from hermit.agent.base.interface import BaseAgent, LoginFailed, Unsupported, make -from hermit.environment import Container, Environment, Limits, Mount, Local, docker as container +from hermit.agent.base.interface import BaseAgent, LoginFailed, make +from hermit.environment import Container, Environment, Limits, Mount, Local, Unsupported, docker as container from hermit.agent.base.login import LOGINS, NO_LOGIN from hermit.agent.model.usage import Ledger from hermit.common import RunOutput, load_callable diff --git a/hermit/agent/base/cli.py b/hermit/agent/base/cli.py index f0432011..6a0f8f23 100644 --- a/hermit/agent/base/cli.py +++ b/hermit/agent/base/cli.py @@ -145,9 +145,9 @@ from hermit.agent.base import login as codex_login from hermit.agent.base.credentials import held -from hermit.environment import docker as container +from hermit.environment import Limits, Mount, Unsupported, docker as container from hermit.environment.base import Environment, ExecResult, _descendants, as_environment -from hermit.agent.base.interface import BaseAgent, Limits, Mount, Result, Unsupported +from hermit.agent.base.interface import BaseAgent, Result from hermit.agent.base.records import (parse_claude, parse_codex, parse_dsh, parse_hermes, parse_mini_swe_agent, parse_opencode, parse_pi, price_usage) from hermit.agent.base.tool import Tool diff --git a/hermit/agent/base/endpoint.py b/hermit/agent/base/endpoint.py index e89fa390..a2509be1 100644 --- a/hermit/agent/base/endpoint.py +++ b/hermit/agent/base/endpoint.py @@ -159,7 +159,7 @@ def answer(self, request: dict, authorization: str | None, abort: threading.Even upstream gave no answer.""" from hermit.agent.base.cli import CliAgent if isinstance(self.agent, CliAgent): - from hermit.agent.base.interface import Unsupported + from hermit.environment import Unsupported try: return cli_answer(self.agent, request, abort, place=self.place) except (ValueError, Unsupported) as exc: # the session's settings: the client reads why diff --git a/hermit/agent/base/react.py b/hermit/agent/base/react.py index 1c93ce00..203f994b 100644 --- a/hermit/agent/base/react.py +++ b/hermit/agent/base/react.py @@ -31,10 +31,11 @@ import time from typing import Any, Sequence -from hermit.agent.base.interface import BaseAgent, Result, Unsupported, as_environment, as_messages +from hermit.agent.base.interface import BaseAgent, Result from hermit.agent.base.tool import Tool from hermit.agent.base.trajectory import Step -from hermit.agent.model.direct import client_of +from hermit.agent.model.direct import as_messages, client_of +from hermit.environment import Unsupported, as_environment def message_steps(message: dict, calls: bool = True) -> list[Step]: diff --git a/hermit/agent/evolver/methods/ahe_adapter/debugger.py b/hermit/agent/evolver/methods/ahe_adapter/debugger.py index e526139e..04672bb0 100644 --- a/hermit/agent/evolver/methods/ahe_adapter/debugger.py +++ b/hermit/agent/evolver/methods/ahe_adapter/debugger.py @@ -50,8 +50,8 @@ import threading import time -from hermit.agent.base.interface import LoginFailed, Unsupported, make -from hermit.environment import placed +from hermit.agent.base.interface import LoginFailed, make +from hermit.environment import Unsupported, placed from hermit.agent.base.trajectory import CODEX_STREAM, STREAMS, log_steps from hermit.agent.evolver.base import Usage from hermit.agent.evolver.methods.ahe_adapter import trajectory as _trajectory diff --git a/hermit/isolate.py b/hermit/isolate.py index 5df32362..a8f13891 100644 --- a/hermit/isolate.py +++ b/hermit/isolate.py @@ -54,7 +54,8 @@ program_paths, sandbox_fault, sanitized_copy, set_hidden) from hermit.environment.bwrap import task_sandbox from hermit.environment.spec import EnvironmentSpec -from hermit.task import RunOutput, load_callable, output_record +from hermit.common import RunOutput, load_callable +from hermit.task import output_record from hermit.task.verify import LOGS, SANDBOX_ENV, TESTS SCRIPT_VERIFIER = ("hermit.task.verify", "script") # judge: {path, name} of a task directory's own verifier diff --git a/hermit/settings_check.py b/hermit/settings_check.py index 80aa1d41..05188383 100644 --- a/hermit/settings_check.py +++ b/hermit/settings_check.py @@ -19,7 +19,8 @@ from hermit.agent.acting.agent import load_agent from hermit.isolate import agent_pipeline, config_paths, host_pipeline, judge_for, task_environments, \ validate as validate_sandboxes -from hermit.task import Benchmark, load_callable +from hermit.task import Benchmark +from hermit.common import load_callable from hermit.trainer.rollout import run_one from hermit.trainer.trainer import needs_errors, warnings_for diff --git a/hermit/worker.py b/hermit/worker.py index 982ec656..ca0a1e3e 100644 --- a/hermit/worker.py +++ b/hermit/worker.py @@ -26,7 +26,8 @@ def _run(job: dict) -> dict: if job["kind"] == "agent": from hermit.adapter.session import ENV_PYTHON, ENV_SANDBOX from hermit.agent.acting.agent import load_agent - from hermit.task import RunOutput, output_record + from hermit.common import RunOutput + from hermit.task import output_record # The adapter's tools never run in this process, nor in any it starts (inherited through the environment). os.environ[ENV_SANDBOX] = "1" os.environ[ENV_PYTHON] = sys.executable @@ -38,7 +39,8 @@ def _run(job: dict) -> dict: return {"ok": True, "output": output_record(out)} if job["kind"] == "judge": from dataclasses import asdict - from hermit.task import RunOutput, load_callable, normalise_judge + from hermit.common import RunOutput, load_callable + from hermit.task import normalise_judge rec = dict(job["output"]) out = RunOutput(**{**rec, "log": Path(rec["log"]) if rec.get("log") else None}) verdict = normalise_judge(load_callable(job["spec"], Path(job["base"]))(dict(job["task"]), out)) diff --git a/tests/core/test_agents.py b/tests/core/test_agents.py index b4c7c3c1..e79c900a 100644 --- a/tests/core/test_agents.py +++ b/tests/core/test_agents.py @@ -165,7 +165,7 @@ def test_load_agent_builtin_class_function_and_alias(tmp_path): claude = load_agent("claude-code", {"model": "m"}, tmp_path) assert isinstance(claude, CliAgent) and claude.params["backend"] == "claude" and claude.base == tmp_path.resolve() (tmp_path / "agent.py").write_text( - "from hermit.agent.acting import Agent\nfrom hermit.task import RunOutput\n" + "from hermit.agent.acting import Agent\nfrom hermit.common import RunOutput\n" "class Mine(Agent):\n def run(self, task, adapter):\n return RunOutput(output=(self.params['k'], str(self.base.name), adapter))\n" "def plain(task, adapter):\n return RunOutput(output='plain')\n") mine = load_agent("agent.py:Mine", {"k": 1}, tmp_path) diff --git a/tests/core/test_base_agents.py b/tests/core/test_base_agents.py index 39eed84c..7078f886 100644 --- a/tests/core/test_base_agents.py +++ b/tests/core/test_base_agents.py @@ -7,10 +7,10 @@ import pytest from fakes import FunctionModel -from hermit.agent.base.interface import Limits, Mount, Unsupported, make +from hermit.agent.base.interface import make from hermit.agent.base.tool import Tool from hermit.agent.base.tool_server import ToolServer -from hermit.environment import Container, Local, Sandboxed +from hermit.environment import Container, Limits, Local, Mount, Sandboxed, Unsupported from hermit.agent.model.direct import Direct diff --git a/tests/core/test_claude_subscription.py b/tests/core/test_claude_subscription.py index 105610dc..d02adda2 100644 --- a/tests/core/test_claude_subscription.py +++ b/tests/core/test_claude_subscription.py @@ -20,7 +20,7 @@ from hermit.agent.acting import workspace as acting from hermit.agent.base import cli as base_cli, login as subscription from hermit.agent.base.endpoint import cli_endpoint, cli_model, cli_problems, endpoint_spec -from hermit.agent.base.interface import Limits, LoginFailed, Result, Unsupported, make +from hermit.agent.base.interface import LoginFailed, Result, make from hermit.agent.base.records import parse_log from hermit.agent.model.backends import normalize_config from hermit.agent.model.llm import ChatAborted, ChatClient, ChatHTTPError @@ -28,7 +28,7 @@ from hermit.sandbox import Sandbox from claude_stand import INDEX, ROOT, STREAMS, TOKEN, bwrap_works, stand # noqa: F401 (stand: the fixture) -from hermit.environment import Container, Local, Sandboxed +from hermit.environment import Container, Limits, Local, Sandboxed, Unsupported EXAMPLE = ROOT / "examples" / "claude_subscription" diff --git a/tests/core/test_cli_agent.py b/tests/core/test_cli_agent.py index 27c7e6ad..5b6212f3 100644 --- a/tests/core/test_cli_agent.py +++ b/tests/core/test_cli_agent.py @@ -13,10 +13,9 @@ from hermit.agent.base import trajectory from hermit.agent.acting import workspace as cli from hermit.agent.base import cli as base_cli -from hermit.agent.base.interface import Limits as LIMITS from hermit.agent.base import login from hermit.environment import docker as container -from hermit.environment import Sandboxed +from hermit.environment import Limits as LIMITS, Sandboxed from hermit.agent.base.interface import make ROOT = Path(__file__).resolve().parents[2] diff --git a/tests/core/test_dsh_agent.py b/tests/core/test_dsh_agent.py index 3508ef9d..2f44889c 100644 --- a/tests/core/test_dsh_agent.py +++ b/tests/core/test_dsh_agent.py @@ -20,9 +20,9 @@ from hermit.agent.base import cli as base_cli from hermit.agent.base import trajectory -from hermit.agent.base.interface import Unsupported, make +from hermit.agent.base.interface import make from hermit.agent.base.tool import Tool -from hermit.environment import Container, Local, Sandboxed, placed +from hermit.environment import Container, Local, Sandboxed, Unsupported, placed from hermit.agent.model.backends import bind_agent_params, registry ROOT = Path(__file__).resolve().parents[2] @@ -559,7 +559,7 @@ def test_what_dsh_cannot_use_is_refused_rather_than_dropped(fake, monkeypatch, t def test_a_tasks_data_is_bound_in_the_workspace_where_bubblewrap_can_bind_it(fake, monkeypatch, tmp_path): """dsh's glob and grep run ripgrep without --follow: without isolation a task's data inside the workspace is bound there, a real read-only directory that a search walks into (as for Claude Code), not linked.""" - from hermit.agent.base.interface import Limits, Mount + from hermit.environment import Limits, Mount if base_cli._bwrap_binds() is None: pytest.skip("needs a working bubblewrap") data = tmp_path / "data" @@ -1099,7 +1099,7 @@ def test_with_the_dsh_cli_a_tasks_data_is_found_by_dshs_own_search(tmp_path, mon """dsh's glob and grep run ripgrep without --follow, so a task's data linked into the workspace was never listed or matched. Without isolation it is bound there, a real directory: dsh's own search finds it, and dsh's own sandbox, nested in that mount namespace, runs a command that reads it.""" - from hermit.agent.base.interface import Limits, Mount + from hermit.environment import Limits, Mount if base_cli._bwrap_binds() is None: pytest.skip("needs a working bubblewrap") data, work = tmp_path / "data", tmp_path / "work" diff --git a/tests/core/test_environment.py b/tests/core/test_environment.py index 0a58c0c4..c47edded 100644 --- a/tests/core/test_environment.py +++ b/tests/core/test_environment.py @@ -8,8 +8,8 @@ import pytest -from hermit.agent.base.interface import Unsupported, make -from hermit.environment import Container, Limits, Local, Sandboxed, as_environment, placed +from hermit.agent.base.interface import make +from hermit.environment import Container, Limits, Local, Sandboxed, Unsupported, as_environment, placed from hermit.agent.model.usage import Usage diff --git a/tests/core/test_hermes_agent.py b/tests/core/test_hermes_agent.py index cd1834e3..c5819c57 100644 --- a/tests/core/test_hermes_agent.py +++ b/tests/core/test_hermes_agent.py @@ -18,12 +18,12 @@ import pytest -from hermit.environment import Container, placed +from hermit.environment import Container, Unsupported, placed import yaml from hermit.agent.base import cli as base_cli from hermit.agent.base import trajectory -from hermit.agent.base.interface import Unsupported, make +from hermit.agent.base.interface import make from hermit.agent.base.records import HERMES_AUX, parse_hermes, parse_log from hermit.agent.base.tool import Tool from hermit.agent.model.backends import bind_agent_params, registry diff --git a/tests/core/test_isolate.py b/tests/core/test_isolate.py index 4fc83748..7fbe6475 100644 --- a/tests/core/test_isolate.py +++ b/tests/core/test_isolate.py @@ -261,7 +261,7 @@ def snapshot(source): SNOOP = r''' import json, os, subprocess, sys from pathlib import Path -from hermit.task import RunOutput +from hermit.common import RunOutput def _peek(path): try: @@ -431,7 +431,7 @@ def score(task, out): PIPELINE_PLANTS = """ import os -from hermit.task import RunOutput +from hermit.common import RunOutput def run(task, adapter): work = os.getcwd() @@ -589,7 +589,7 @@ def evil(): PIPELINE_WITH_ADAPTER = """ from hermit.adapter.session import Session -from hermit.task import RunOutput +from hermit.common import RunOutput def run(task, adapter): s = Session(adapter) @@ -644,7 +644,7 @@ def test_a_session_in_a_process_the_agent_starts_is_sandboxed_too(tmp_path): """A benchmark's own runner (another process) holding a Session: the setting is inherited.""" from test_session_sandbox import adapter_copy pipeline = ( - "import subprocess, sys\nfrom hermit.task import RunOutput\n\n" + "import subprocess, sys\nfrom hermit.common import RunOutput\n\n" "def run(task, adapter):\n" " code = ('from hermit.adapter.session import Session\\n'\n" " 's = Session(sys.argv[1]); print(s.sandboxed); s.close()')\n" @@ -793,7 +793,7 @@ def test_a_container_agent_runs_from_a_worker_that_sandboxes_the_adapters_code(t (tmp_path / "t").mkdir() config = Config.load(make_task(tmp_path / "t"), []) (tmp_path / "t" / "probe.py").write_text( - "import os\nfrom hermit.task import RunOutput\n" + "import os\nfrom hermit.common import RunOutput\n" "def run(task, adapter):\n" " sandboxed, enforce = os.environ.get('HA_ADAPTER_SANDBOX'), os.environ.get('HA_ADAPTER_SANDBOX_ENFORCE')\n" " return RunOutput(output=f'{sandboxed} {enforce} {os.getpid()}')\n") @@ -831,7 +831,7 @@ class Other(base_cli.Codex): PIPELINE_LINKED_LOG = """ import os from pathlib import Path -from hermit.task import RunOutput +from hermit.common import RunOutput def run(task, adapter): trace = Path(os.getcwd()) / "trace" @@ -1008,7 +1008,7 @@ def test_with_the_pipeline_on_the_host_a_task_tool_keeps_its_sandbox(tmp_path): PIPELINE_LOGS_ITS_KEY = """ import os from pathlib import Path -from hermit.task import RunOutput +from hermit.common import RunOutput def run(task, adapter): log = Path("logs") / "t1.txt" log.parent.mkdir(exist_ok=True) @@ -1114,7 +1114,7 @@ def test_a_failed_agents_call_is_scrubbed_too(tmp_path, monkeypatch): def test_a_sandboxed_judges_directory_and_the_agents_it_wrote_are_scrubbed(tmp_path, monkeypatch): import hermit.isolate as isolate_module - from hermit.task import RunOutput + from hermit.common import RunOutput fake_bwrap(monkeypatch) key = "sk-judge-key-0123456789abcdef" monkeypatch.setenv("JUDGE_API_KEY", key) @@ -1148,7 +1148,7 @@ def test_an_agent_file_beside_the_config_keeps_its_calls_directory(tmp_path): path = make_task(tmp_path, sandbox={"enabled": True}, agent={"name": "pipeline.py:run", "concurrency": 1}, environment={"read": ["pipeline.py"]}) (tmp_path / "pipeline.py").write_text( - "import os\nfrom pathlib import Path\nfrom hermit.task import RunOutput\n" + "import os\nfrom pathlib import Path\nfrom hermit.common import RunOutput\n" "def run(task, adapter):\n" " (Path(os.environ['HOME']) / 'mark').write_text('home')\n" " return RunOutput(output=os.getcwd())\n") @@ -1166,7 +1166,7 @@ def test_without_bubblewrap_a_best_effort_call_keeps_its_log(tmp_path, monkeypat file, is the one kept (no bind was applied to map it through).""" monkeypatch.setattr(sandbox_module.shutil, "which", lambda name, *a, **k: None if name == "bwrap" else REAL_WHICH(name, *a, **k)) - pipeline = ("from pathlib import Path\nfrom hermit.task import RunOutput\n" + pipeline = ("from pathlib import Path\nfrom hermit.common import RunOutput\n" "def run(task, adapter):\n" " log = Path(__file__).resolve().parent / '.logs' / 't1.txt'\n" " log.parent.mkdir(exist_ok=True)\n log.write_text('trajectory')\n" diff --git a/tests/core/test_mini_swe_agent.py b/tests/core/test_mini_swe_agent.py index ffe81718..db661188 100644 --- a/tests/core/test_mini_swe_agent.py +++ b/tests/core/test_mini_swe_agent.py @@ -21,12 +21,12 @@ StrictUndefined = Template = None import pytest -from hermit.environment import Container, Sandboxed +from hermit.environment import Container, Sandboxed, Unsupported import yaml from hermit.agent.acting.agent import load_agent from hermit.agent.base import mini_swe_agent as mini -from hermit.agent.base.interface import Unsupported, make +from hermit.agent.base.interface import make from hermit.agent.base.trajectory import log_steps from hermit.agent.model.backends import bind_agent_params, registry from hermit.hosts import mini_swe_agent as host diff --git a/tests/core/test_opencode_agent.py b/tests/core/test_opencode_agent.py index 212cbf63..18ef0d10 100644 --- a/tests/core/test_opencode_agent.py +++ b/tests/core/test_opencode_agent.py @@ -15,11 +15,11 @@ import pytest -from hermit.environment import Container, placed +from hermit.environment import Container, Unsupported, placed from hermit.agent.base import cli as base_cli from hermit.agent.base import trajectory -from hermit.agent.base.interface import Unsupported, make +from hermit.agent.base.interface import make from hermit.agent.base.tool import Tool from hermit.agent.model.backends import bind_agent_params, registry diff --git a/tests/core/test_pi_agent.py b/tests/core/test_pi_agent.py index b3b9484f..82ae34ac 100644 --- a/tests/core/test_pi_agent.py +++ b/tests/core/test_pi_agent.py @@ -14,11 +14,11 @@ import pytest -from hermit.environment import Container, placed +from hermit.environment import Container, Unsupported, placed from hermit.agent.base import cli as base_cli from hermit.agent.base import trajectory -from hermit.agent.base.interface import Unsupported, make +from hermit.agent.base.interface import make from hermit.agent.base.tool import Tool from hermit.agent.model.backends import Binding, bind_agent_params, registry diff --git a/tests/core/test_task_directory.py b/tests/core/test_task_directory.py index 18d02a32..b2278ddd 100644 --- a/tests/core/test_task_directory.py +++ b/tests/core/test_task_directory.py @@ -123,7 +123,7 @@ def _bwrap_works() -> bool: AGENT = """ import json, os from pathlib import Path -from hermit.task import RunOutput +from hermit.common import RunOutput def run(task, adapter): work = os.getcwd() @@ -298,7 +298,7 @@ def test_a_separate_verifiers_own_memory_is_checked(tmp_path): AGENT_SEES_KEY = """ import os from pathlib import Path -from hermit.task import RunOutput +from hermit.common import RunOutput def run(task, adapter): Path(os.getcwd(), "answer.txt").write_text("42") @@ -354,7 +354,7 @@ def test_a_tasks_own_verifier_never_gets_the_acting_models_key_or_hosts(tmp_path AGENT_BILLED_AND_FAILED = """ -from hermit.task import RunOutput +from hermit.common import RunOutput def run(task, adapter): failed = RuntimeError("chat/completions HTTP 503: busy") diff --git a/tests/methods/ace/test_ace.py b/tests/methods/ace/test_ace.py index 1c80abdd..66f7c311 100644 --- a/tests/methods/ace/test_ace.py +++ b/tests/methods/ace/test_ace.py @@ -499,7 +499,7 @@ def test_the_step_needs_the_llm_tool_and_a_playbook(tmp_path): PIPELINE = ''' import re from pathlib import Path -from hermit.task import RunOutput +from hermit.common import RunOutput def run(task, adapter): text = (Path(adapter) / "ADAPTER.md").read_text() if adapter else "" diff --git a/tests/methods/ahe/test_ahe_adapter_example.py b/tests/methods/ahe/test_ahe_adapter_example.py index 1892b384..272fc82d 100644 --- a/tests/methods/ahe/test_ahe_adapter_example.py +++ b/tests/methods/ahe/test_ahe_adapter_example.py @@ -20,7 +20,8 @@ from hermit.agent.evolver.methods.ahe_adapter import debugger as D from hermit.agent.model.backends import registry from hermit.config import Config -from hermit.task import RunOutput, TaskData, load_callable +from hermit.common import RunOutput, load_callable +from hermit.task import TaskData from hermit.trainer.material import Material from hermit.trainer.rollout import run_one diff --git a/tests/methods/ahe/test_ahe_evolver.py b/tests/methods/ahe/test_ahe_evolver.py index d5531ba7..8b4ab206 100644 --- a/tests/methods/ahe/test_ahe_evolver.py +++ b/tests/methods/ahe/test_ahe_evolver.py @@ -28,7 +28,7 @@ PIPELINE = ''' import json from pathlib import Path -from hermit.task import RunOutput +from hermit.common import RunOutput def run(task, adapter): text = (Path(adapter) / "ADAPTER.md").read_text() if adapter else "" diff --git a/tests/methods/ahe/test_ahe_on_claude.py b/tests/methods/ahe/test_ahe_on_claude.py index edf56fb0..84a4608e 100644 --- a/tests/methods/ahe/test_ahe_on_claude.py +++ b/tests/methods/ahe/test_ahe_on_claude.py @@ -58,7 +58,7 @@ def test_the_agent_debugger_stops_at_a_lost_sign_in_or_a_refused_setting(stand, refuses is refused, not turned into every job's canned fallback; setup() refuses it first.""" from hermit.agent.evolver.methods.ahe_adapter import debugger as D from hermit.agent.evolver.methods.ahe_adapter.evolver import AHEAdapterEvolver - from hermit.agent.base.interface import Unsupported + from hermit.environment import Unsupported def prepared(job, scratch, params=None, texts=None): d = Path(scratch) / "jobs" / job.task diff --git a/tests/methods/evosafe/test_agentdyn.py b/tests/methods/evosafe/test_agentdyn.py index b19e6244..119d88ab 100644 --- a/tests/methods/evosafe/test_agentdyn.py +++ b/tests/methods/evosafe/test_agentdyn.py @@ -16,7 +16,7 @@ from bridge import GuardedRuntime, run, score, validate_case from defenses import load_defense from hermit.spec import check_spec -from hermit.task import RunOutput +from hermit.common import RunOutput ROOT = Path(__file__).resolve().parents[3] TEMPLATE = ROOT / "hermit/adapter/templates/evosafe" @@ -231,7 +231,7 @@ def test_trainer_evosafe_end_to_end(tmp_path, monkeypatch): from hermit.tools import FunctionTool (tmp_path / "pipeline.py").write_text(''' -from hermit.task import RunOutput +from hermit.common import RunOutput def run(task, adapter): improved = "tested revision" in (adapter / "ADAPTER.md").read_text() clean = task["kind"] == "clean" diff --git a/tests/methods/evosafe/test_agentdyn_compat.py b/tests/methods/evosafe/test_agentdyn_compat.py index 24000f54..5b8df9c8 100644 --- a/tests/methods/evosafe/test_agentdyn_compat.py +++ b/tests/methods/evosafe/test_agentdyn_compat.py @@ -228,7 +228,7 @@ def test_failed_episode_is_metered_and_recorded_as_a_failed_run(tmp_path): """Without a core change: the bridge returns the failed episode's usage and log, its judge raises, and the Trainer's rollout records a failed run (never a verdict) that keeps them.""" from bridge import score - from hermit.task import RunOutput + from hermit.common import RunOutput from hermit.trainer.rollout import run_one task = {"id": "c1", "kind": "clean", "suite": "shopping", "user_task_id": "user_task_0"} out = RunOutput(output={"episode_error": "episode did not produce a terminal assistant response"}, diff --git a/tests/methods/evosafe/test_agentdyn_live_backends.py b/tests/methods/evosafe/test_agentdyn_live_backends.py index 28b63ad0..edfce75b 100644 --- a/tests/methods/evosafe/test_agentdyn_live_backends.py +++ b/tests/methods/evosafe/test_agentdyn_live_backends.py @@ -238,7 +238,7 @@ def test_cached_victim_and_classifier_usage_reaches_budget(tmp_path, usage_provi from victim import make_victim from auditor import OutputClassifier from bridge import metered, score - from hermit.task import RunOutput + from hermit.common import RunOutput from hermit.trainer.rollout import run_tasks from hermit.trainer.budget import Budget pending, params = usage_provider diff --git a/tests/methods/evosafe/test_agentdyn_review.py b/tests/methods/evosafe/test_agentdyn_review.py index 8d18317e..234015bb 100644 --- a/tests/methods/evosafe/test_agentdyn_review.py +++ b/tests/methods/evosafe/test_agentdyn_review.py @@ -25,7 +25,8 @@ def test_real_eval_rows_without_input(tmp_path): (tmp_path / 'test.txt').write_text('c\na\ne\n') (tmp_path / 'train.txt').write_text('') (tmp_path / 'fixture.py').write_text(""" -from hermit.task import RunOutput, JudgeResult +from hermit.common import RunOutput +from hermit.task import JudgeResult def run(task, adapter): if task['id'] == 'e': raise RuntimeError('fixture failure') return RunOutput(output={'kind': task['kind'], 'utility': True, 'attack_success': False}) diff --git a/tests/methods/evosafe/test_evosafe_on_pi.py b/tests/methods/evosafe/test_evosafe_on_pi.py index 41df15ad..eaf33a0c 100644 --- a/tests/methods/evosafe/test_evosafe_on_pi.py +++ b/tests/methods/evosafe/test_evosafe_on_pi.py @@ -105,7 +105,7 @@ def test_a_whole_training_proposes_on_pi_with_its_bound_model(tmp_path, monkeypa from hermit.trainer.trainer import Trainer monkeypatch.setenv("FAKE_KEY", "sk-fake") (tmp_path / "pipeline.py").write_text(''' -from hermit.task import RunOutput +from hermit.common import RunOutput def run(task, adapter): improved = "tested revision" in (adapter / "ADAPTER.md").read_text() return RunOutput(output={"kind": task["kind"], "utility": True, diff --git a/tests/methods/mwm/test_mwm_evolver.py b/tests/methods/mwm/test_mwm_evolver.py index e356f08d..395c119f 100644 --- a/tests/methods/mwm/test_mwm_evolver.py +++ b/tests/methods/mwm/test_mwm_evolver.py @@ -90,7 +90,7 @@ def _call(name, body): PIPELINE = textwrap.dedent(''' import os from pathlib import Path - from hermit.task import RunOutput + from hermit.common import RunOutput def run(task, adapter): evidence = Path(os.environ["MWM_TEST_EVIDENCE"]) diff --git a/tests/methods/opro/test_opro.py b/tests/methods/opro/test_opro.py index 7d2fb952..c5b3a78f 100644 --- a/tests/methods/opro/test_opro.py +++ b/tests/methods/opro/test_opro.py @@ -324,7 +324,7 @@ def test_the_step_needs_the_model(tmp_path): PIPELINE = ''' from pathlib import Path -from hermit.task import RunOutput +from hermit.common import RunOutput def run(task, adapter): text = (Path(adapter) / "ADAPTER.md").read_text() if adapter else "" diff --git a/tests/methods/optimizers/test_optimizer_evolvers.py b/tests/methods/optimizers/test_optimizer_evolvers.py index 589d9de3..c0d4a50e 100644 --- a/tests/methods/optimizers/test_optimizer_evolvers.py +++ b/tests/methods/optimizers/test_optimizer_evolvers.py @@ -22,7 +22,7 @@ PIPELINE = ''' from pathlib import Path -from hermit.task import RunOutput +from hermit.common import RunOutput def run(task, adapter): text = (Path(adapter) / "ADAPTER.md").read_text() if adapter else "" diff --git a/tests/methods/reharness/test_reharness.py b/tests/methods/reharness/test_reharness.py index 254ecff5..69d55d42 100644 --- a/tests/methods/reharness/test_reharness.py +++ b/tests/methods/reharness/test_reharness.py @@ -30,7 +30,7 @@ PIPELINE = ''' from hermit import Session -from hermit.task import RunOutput +from hermit.common import RunOutput def run(task, adapter): session = Session(adapter) if adapter else None diff --git a/tests/methods/she/test_agentdyn_she.py b/tests/methods/she/test_agentdyn_she.py index 228acc3e..34bcada9 100644 --- a/tests/methods/she/test_agentdyn_she.py +++ b/tests/methods/she/test_agentdyn_she.py @@ -365,7 +365,7 @@ def test_trainer_end_to_end(tmp_path, monkeypatch): from hermit.tools import FunctionTool (tmp_path / "pipeline.py").write_text(''' -from hermit.task import RunOutput +from hermit.common import RunOutput def run(task, adapter): improved = "tested revision" in (adapter / "artifacts/system_prompt.md").read_text() clean = not task.get("injection_task_id") diff --git a/tests/toy_task.py b/tests/toy_task.py index 81fbe77f..9bfddf34 100644 --- a/tests/toy_task.py +++ b/tests/toy_task.py @@ -8,7 +8,7 @@ PIPELINE = ''' from pathlib import Path -from hermit.task import RunOutput +from hermit.common import RunOutput def run(task, adapter): text = (Path(adapter) / "ADAPTER.md").read_text() if adapter else ""