API reference for creating environments
The hud.gym
module provides the core function for creating Environment instances.
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 @register_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.
str
(Gym ID like "hud-browser"
, "OSWorld-Ubuntu"
), creates a standard remote environment.CustomGym
object, creates a custom environment based on its definition (local or remote docker).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 @register_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()
).