File size: 3,062 Bytes
b891545 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | # SPDX-License-Identifier: BSD-3-Clause
"""Harness integration helpers for training, evaluation, and wrapping agents.
This package hosts two complementary layers:
1. **Trainer-side rollout API** (``openenv.core.harness.rollout``): a harness
drives an entire episode in one call (``run_white_box``/``run_black_box``)
against a resource session. Used by ``openenv collect`` and the training
tutorials.
2. **Turn-based agentic harness API** (RFC 005): an external harness such as
OpenClaw or Claude Code runs inside the environment container, and each
``step()`` is one conversational turn. See
[`~openenv.core.harness.environment.HarnessEnvironment`] and
[`~openenv.core.harness.adapter.AgenticHarnessAdapter`].
Both layers are importable from ``openenv.core.harness``.
"""
from .adapter import (
AgenticHarnessAdapter,
HarnessError,
HarnessNotRunningError,
HarnessStartupError,
HarnessTurnTimeoutError,
)
from .bridge import build_bridge_server, HarnessMCPBridge
from .config import HarnessConfig, HarnessTransport
from .environment import HarnessAction, HarnessEnvironment
from .events import (
events_to_metadata,
HarnessClientMessage,
HarnessEvent,
HarnessEventType,
HarnessResponse,
)
from .process import HarnessProcess
from .rollout import ( # noqa: F401 (_resolve_env_reward: private back-compat re-export)
_resolve_env_reward,
build_harness_rollout_func,
CLIHarnessAdapter,
HarnessAdapter,
HarnessRolloutResult,
HarnessRunLimits,
LoopOwningSession,
MCPHarnessAdapter,
Message,
ModelStep,
ModelStepResult,
RESERVED_TOOL_NAMES,
ResourceSession,
ResourceSessionFactory,
RolloutEvent,
SessionMCPBridge,
StepEnvSessionAdapter,
ToolResult,
ToolTraceEntry,
TraceEntry,
TrainableSession,
VerifyResult,
)
from .tools import resolve_tool_conflicts
from .training import TrainingTrace, TrainingTurn
__all__ = [
# Trainer-side rollout API (openenv.core.harness.rollout)
"CLIHarnessAdapter",
"HarnessAdapter",
"HarnessRolloutResult",
"HarnessRunLimits",
"LoopOwningSession",
"MCPHarnessAdapter",
"Message",
"ModelStep",
"ModelStepResult",
"RESERVED_TOOL_NAMES",
"ResourceSession",
"ResourceSessionFactory",
"RolloutEvent",
"SessionMCPBridge",
"StepEnvSessionAdapter",
"ToolResult",
"ToolTraceEntry",
"TraceEntry",
"TrainableSession",
"TrainingTrace",
"TrainingTurn",
"VerifyResult",
"build_harness_rollout_func",
# Turn-based agentic harness API (RFC 005)
"AgenticHarnessAdapter",
"HarnessAction",
"HarnessClientMessage",
"HarnessConfig",
"HarnessEnvironment",
"HarnessError",
"HarnessEvent",
"HarnessEventType",
"HarnessMCPBridge",
"HarnessNotRunningError",
"HarnessProcess",
"HarnessResponse",
"HarnessStartupError",
"HarnessTransport",
"HarnessTurnTimeoutError",
"build_bridge_server",
"events_to_metadata",
"resolve_tool_conflicts",
]
|