rlmesh.torch.EnvFactory

classExperimentalfrom rlmesh.torch import EnvFactory[source]

Torch-backed EnvFactory: served envs speak torch.

The producer-side mirror of Model (the author’s own class). Subclass and implement make exactly as for rlmesh.EnvFactory; the torch framework rides this class, so every serve route (serve, the python -m rlmesh.serve CLI, a prebuilt/sandbox image) types the obs/action seam as torch without a per-entrypoint flag. To serve a plain (already-built) env, hand it to the neutral rlmesh.EnvServer(env, framework="torch") instead – the server stays framework-neutral; the framework is a value you set on the env side.

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.