rlmesh.EnvFactory
Authoring base that *builds* environment(s): set tags and implement make.
Subclass per obs/action contract – the tags (a EnvTags)
are that contract. make(**kwargs) is the factory and may return a single env or a
vectorized batch; task selection and num_envs are its parameters, not separate
subclasses. tags = None (the default) means a generic, un-adapted env.
Optionally set params to a ParamSpec declaring make’s
construction parameters; a managed dashboard then presents/validates/sweeps
them, and a bad binding is rejected before construction (see
rlmesh.params). params = None (default) keeps today’s blind
passthrough to make.
Optionally implement an enumerate_variants() classmethod that returns a
list of Variant (or yield them lazily) – the finite,
named catalog of concrete sub-environments this factory contains (e.g. one per
benchmark task). Each
variant binds only its identity-defining params; the remaining free dials
stay in params (the ParamSpec is always the full validation surface –
never describe the same dimension in both enumerate_variants and
enumerate_params). Import heavy/optional deps lazily inside the method, as
make does, so describe stays off-GPU. See rlmesh.describe().
Attributes
Methods
- tags_for()Return the
EnvTagsfor one discriminant binding. - prepare()Optional: one-time setup before
make(). - describe()Return this factory's full metadata envelope (see
rlmesh.describe()). - make()Construct and return the environment.
- close()Optional: release resources.
- serve()Host this env on
address(blocking):prepare()+make(**make_kwargs), publishtags.
params
attribute[source]params: ParamSpec | Nonetag_params
attribute[source]tag_params: tuple[str, ...]reset_options
attribute[source]reset_options: tuple[str, ...]workflow_edition
attribute[source]workflow_edition: str | Noneprepare
function[source]prepare() -> NoneOptional: one-time setup before make().
describe
function[source]describe() -> dict[str, Any]Return this factory’s full metadata envelope (see rlmesh.describe()).
make
function[source]make(**kwargs: Any) -> EnvLike[Any, Any]Construct and return the environment.
Your override returns a plain env; the returned env is automatically
stamped with this factory’s tags (in env.metadata), so the tag
rides the environment – a spec’d model can resolve its adapter from the
env alone, whether it is served or driven locally via
rlmesh.session().
close
function[source]close() -> NoneOptional: release resources.
serve
function[source]serve(
address: str,
*,
num_envs: int = 1,
vectorization_mode: str | None = None,
framework: str | None = None,
device: object | None = None,
workflow_edition: str | None = None,
**make_kwargs: Any,
) -> NoneHost this env on address (blocking): prepare() + make(**make_kwargs), publish tags.
The named keywords are serving options, forwarded to
rlmesh.serve.serve_env() (num_envs > 1 fans make out into a
vector env; framework/device type and place the served obs/action
seam; workflow_edition overrides this class’s
workflow_edition declaration for this endpoint); every other
keyword goes to make. Naming them here keeps a make
kwarg from silently binding to a serving option – a make parameter that
shares a serving option’s name cannot ride through serve.