The hud.gym module provides the core function for creating Environment instances.

Module Functions

make

async def make(
    env_src: Gym | Task,
    *,
    job: Job | None = None,
    metadata: dict[str, Any] | None = None,
) -> Environment:

Creates and initializes an Environment instance based on a specification.

This function handles selecting the correct client (local docker, remote docker, remote direct) based on the env_src, automatically linking to an active Job (from @job decorator or the job parameter), and running the initial Task setup if env_src is a Task.

Parameters:

  • env_src (Gym | Task): The source specification for the environment.
    • If a str (Gym ID like "hud-browser", "OSWorld-Ubuntu"), creates a standard remote environment.
    • If a CustomGym object, creates a custom environment based on its definition (local or remote docker).
    • If a Task object, uses the task.gym attribute to determine the environment type and automatically runs task.setup after creation.
  • job (Job | None, optional): A specific Job object to associate this environment run with. If None, it attempts to find an active job created by the @job decorator.
  • metadata (dict[str, Any] | None, optional): Additional metadata to attach to the environment instance and its resulting trajectory.

Returns:

  • Environment: An initialized environment instance ready for interaction (e.g., calling env.step()).