Environment object is the wire-protocol control handle for one: it holds the capabilities and
tasks registered against it and answers an agent harness over the protocol.
Authoring an env.py lives in creating an environment; this
page is the object and its serving API.
The Environment object
hud.environment.Environment is the lightweight control object the whole file hangs off. When
served, it acts as the server an agent harness connects to: it answers hello with its
capabilities and runs its tasks on request.
Methods
You register capabilities, lifecycle hooks, and tasks against the object with these methods. Each becomes part of what the environment advertises when it serves.
The
@env.template() decorator takes optional arguments:
Grading and collecting tasks into tasksets are their own topics: see graders
and Tasks & Tasksets.
Serving
You rarely serve by hand -hud eval, task.run(), and Taskset.run() bring
the environment up for you, and the runtime you pass decides where. Serving
itself belongs to hud.environment.server, the entry point every substrate runs: a
SubprocessRuntime child process, a container CMD, or hud serve.
The server module is the same entry point a container CMD runs:
A dependency that must own the process main thread (e.g. Isaac Sim / Omniverse) can’t run under
hud serve, which runs the asyncio loop on main. Run serve(env, host, port) on a worker thread
instead and keep the main thread for the dependency - see Robots.