Types

The rlmesh.types module defines the structural protocols accepted by EnvServer and shared value aliases used by dependency-free clients.

Public structural protocols and shared value aliases.

class rlmesh.types.EnvLike[source]

Bases: Protocol[EnvObsT, EnvActT]

Structural protocol for single environment.

property observation_space: SpaceLike[EnvObsT][source]

Space describing reset and step observations.

property action_space: SpaceLike[EnvActT][source]

Space describing accepted actions.

reset(*, seed=None, options=None)[source]

Reset the environment and return the initial observation.

Parameters:
  • seed (int | None)

  • options (dict[str, object] | None)

Return type:

tuple[EnvObsT, dict[str, object]]

step(action)[source]

Apply one action and return the Gymnasium-style step tuple.

Parameters:

action (EnvActT)

Return type:

tuple[EnvObsT, SupportsFloat, bool, bool, dict[str, object]]

close()[source]

Release environment resources.

Return type:

None

__init__(*args, **kwargs)
class rlmesh.types.SpaceLike[source]

Bases: Protocol[SpaceT]

Structural protocol for RLMesh-compatible spaces.

sample()[source]

Return one valid sample from the space.

Return type:

SpaceT

contains(value, /)[source]

Return whether value belongs to the space.

Parameters:

value (Any)

Return type:

bool

seed(seed=None)[source]

Seed the space sampler.

Parameters:

seed (int | None)

Return type:

int | list[int] | dict[str, int] | None

__init__(*args, **kwargs)
class rlmesh.types.VectorEnvLike[source]

Bases: Protocol[BatchActionT, VectorObsT, VectorActT]

Structural protocol for vectorized environments.

property num_envs: int[source]

Number of environment instances in the vector.

property single_observation_space: SpaceLike[VectorObsT][source]

Observation space for one environment in the vector.

property single_action_space: SpaceLike[VectorActT][source]

Action space for one environment in the vector.

reset(*, seed=None, options=None)[source]

Reset all environments and return batched observations.

Parameters:
  • seed (int | None)

  • options (dict[str, object] | None)

Return type:

tuple[object, dict[str, object]]

step(actions)[source]

Apply a batch of actions and return batched step values.

Parameters:

actions (BatchActionT)

Return type:

tuple[object, object, object, object, dict[str, object]]

close()[source]

Release vector environment resources.

Return type:

None

__init__(*args, **kwargs)