rlmesh.EnvFactory

classfrom rlmesh import EnvFactory[source]

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().

tags

attribute[source]
tags: EnvTags | None

params

attribute[source]
params: ParamSpec | None

tag_params

attribute[source]
tag_params: tuple[str, ...]

reset_options

attribute[source]
reset_options: tuple[str, ...]

workflow_edition

attribute[source]
workflow_edition: str | None

tags_for

function[source]
tags_for(**params: Any) -> EnvTags | None

Return the EnvTags for one discriminant binding.

Override it alongside tag_params when the declared discriminants pick between different contracts (e.g. an action_type that switches end-effector deltas for absolute targets); params carries every declared discriminant, defaults applied. The default returns tags, so a tag_params that only moves the spaces needs no override.

The binding whose values are make’s own signature defaults is the default branch, and its result must be tags – that is the contract a reader with no branch information sees.

prepare

function[source]
prepare() -> None

Optional: 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() -> None

Optional: 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,
) -> None

Host 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.