rlmesh.torch.RemoteVectorEnv

classExperimentalfrom rlmesh.torch import RemoteVectorEnv[source]

Experimental Torch-backed remote client for vectorized environments.

RemoteVectorEnv(
    address: str | None = None,
    *,
    host: str | None = None,
    port: int | None = None,
    path: str | None = None,
    transport: Transport | None = None,
    connect_timeout_seconds: float | None = None,
    request_timeout_seconds: float | None = None,
    workflow_edition: str | None = None,
) -> None

A vector client connects one model process to an endpoint that owns multiple environment instances. Batched observations, rewards, terminations, and truncations decode into Torch values.

Parameters

NameTypeDescription
addressstr | NoneEndpoint address such as "tcp://127.0.0.1:5555".
hoststr | NoneTCP host helper used when address is omitted.
portint | NoneTCP port helper used when address is omitted.
pathstr | NoneUnix socket path helper used when address is omitted.
transportTransport | NoneExplicit transport selector.
connect_timeout_secondsfloat | NoneOptional dial timeout in seconds; None uses the native default.
request_timeout_secondsfloat | NoneOptional per-request (reset/step/render) timeout in seconds; None waits indefinitely.

Examples

>>> from rlmesh.torch import RemoteVectorEnv
>>> envs = RemoteVectorEnv("127.0.0.1:5555")
>>> observations, infos = envs.reset(seed=42)
>>> actions = [
...     envs.single_action_space.sample() for _ in range(envs.num_envs)
... ]
>>> observations, rewards, terminations, truncations, infos = envs.step(
...     actions
... )
>>> envs.close()

num_envs

property[source]
property num_envs: int

Number of environment instances served by the endpoint.

single_observation_space

property[source]
property single_observation_space: Space[ValueT]

Observation space for one environment in the vector.

single_action_space

property[source]
property single_action_space: Space[ActionT]

Action space for one environment in the vector.

observation_space

property[source]
property observation_space: Space[ValueT]

Alias for single_observation_space.

action_space

property[source]
property action_space: Space[ActionT]

Alias for single_action_space.

reset

function[source]
reset(
    *,
    seed: int | list[int] | None = None,
    options: dict[str, object] | None = None,
) -> tuple[ValueT, ResetInfo]

Reset all remote environments and decode the observations.

Parameters

NameTypeDescription
seedint | list[int] | NoneOptional seed or per-environment seed list.
optionsdict[str, object] | NoneOptional reset options forwarded to the vector environment.

Returns

TypeDescription
tuple[ValueT, ResetInfo]Batched decoded observations and reset info dictionary.

step

function[source]
step(
    actions: ActionT,
) -> tuple[ValueT, ValueT, ValueT, ValueT, StepInfo]

Step all remote environments with a batch of actions.

Parameters

NameTypeDescription
actionsActionTBatched actions accepted by the vector endpoint.

Returns

TypeDescription
tuple[ValueT, ValueT, ValueT, ValueT, StepInfo]Batched observations, rewards, terminations, truncations, and info.

address

property[source]
property address: str

Endpoint address this client is connected to.

env_id

property[source]
property env_id: str

This connection’s container id (UUIDv7).

A stable correlation identity, distinct from the human env name (env_contract.id).

selected_workflow_edition

property[source]
property selected_workflow_edition: str

The workflow edition this connection negotiated with the env.

The highest edition both sides can drive, at or below whatever either declared, in the exact spelling they agreed on – so a prerelease build reports its cohort, not the bare sealed base. Named apart from the workflow_edition declaration surfaces on purpose: this is what was agreed, not what this side asked for.

env_contract

property[source]
property env_contract: EnvContract

Environment contract returned by the endpoint handshake.

render_mode

property[source]
property render_mode: str | None

Configured render mode reported by the endpoint.

metadata

property[source]
property metadata: Metadata

Endpoint metadata reported by the environment contract.

observation_space_spec

property[source]
property observation_space_spec: SpaceSpec

Native observation space spec reported by the endpoint.

action_space_spec

property[source]
property action_space_spec: SpaceSpec

Native action space spec reported by the endpoint.

render

function[source]
render(*, env_index: int = 0) -> ValueT | None

Render a frame from the remote environment.

Parameters

NameTypeDescription
env_indexintEnvironment index to render. Single environments use 0.

Returns

TypeDescription
ValueT | NoneA decoded render frame, or None when the environment has no frame.

close

function[source]
close() -> None

Detach this client from the remote endpoint.

shutdown

function[source]
shutdown(reason: str = 'owner shutdown') -> bool

Request owner-level shutdown of the remote environment endpoint.