rlmesh.numpy.RemoteEnv

classfrom rlmesh.numpy import RemoteEnv[source]

NumPy-backed remote client for a single RLMesh environment.

RemoteEnv(
    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

Observations, rewards, and actions are decoded into Python primitives, NumPy arrays, or nested containers of those values. Use this client when a model or notebook expects NumPy values at the environment boundary.

Parameters

NameTypeDescription
addressstr | NoneEndpoint address such as "tcp://127.0.0.1:5555", "127.0.0.1:5555", or "unix:///tmp/env.sock".
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.numpy import RemoteEnv
>>> env = RemoteEnv("127.0.0.1:5555")
>>> observation, info = env.reset(seed=42)
>>> observation, reward, terminated, truncated, info = env.step(0)
>>> env.close()

observation_space

property[source]
property observation_space: Space[ValueT]

Observation space loaded from the remote environment contract.

action_space

property[source]
property action_space: Space[ActionT]

Action space loaded from the remote environment contract.

reset

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

Reset the remote environment and decode the observation.

Parameters

NameTypeDescription
seedint | NoneOptional environment reset seed.
optionsdict[str, object] | NoneOptional reset options forwarded to the environment.

Returns

TypeDescription
tuple[ValueT, ResetInfo]A decoded observation and reset info dictionary.

step

function[source]
step(action: ActionT) -> tuple[ValueT, float, bool, bool, StepInfo]

Step the remote environment with one encoded action.

Parameters

NameTypeDescription
actionActionTAction accepted by the remote environment action space.

Returns

TypeDescription
tuple[ValueT, float, bool, bool, StepInfo]Observation, reward, terminated flag, truncated flag, and step 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.