opencode-env-rollout / __init__.py
AdithyaSK's picture
AdithyaSK HF Staff
Upload folder using huggingface_hub
9e98d70 verified
"""OpenEnv OpenCode environment.
Exposes a single MCP tool ``run_rollout`` that spawns an E2B sandbox, runs
the OpenCode CLI agent against a caller-supplied LLM endpoint, runs the
caller-supplied verifier script, and returns reward + proxy trace +
workdir contents as a JSON-serialized :class:`RolloutResult`.
The directory name (``openenv``) matches the installed ``openenv-core``
namespace package, so we use lazy ``__getattr__`` resolution to avoid
eager imports that would collide with the installed package when this
folder is on ``sys.path`` (pytest rootdir, etc.).
"""
from __future__ import annotations
__all__ = [
"OpenCodeEnv",
"OpenCodeState",
"RolloutResult",
"RolloutTurn",
]
def __getattr__(name):
if name == "OpenCodeEnv":
from .client import OpenCodeEnv
return OpenCodeEnv
if name in ("OpenCodeState", "RolloutResult", "RolloutTurn"):
from . import models
return getattr(models, name)
raise AttributeError(f"module 'opencode_env_server' has no attribute {name!r}")