Core Exports

Note

This is the autodoc API reference. For authoring guides see Environments and Models.

The top-level rlmesh package re-exports the common entry points: environment serving and clients, model running, sandboxing, and the spaces, types, and adapters subpackages.

The top-level client and model classes are dependency-free wrappers around RLMesh-native values. Reach for them when you want native values and no framework dependency; reach for a backend module (Framework Backends) when you want tensor leaves decoded to NumPy arrays or Torch tensors.

Import

Description

rlmesh.EnvServer

Serve a Gymnasium-compatible environment endpoint (scalar or vector).

rlmesh.RemoteEnv

Connect to one environment and preserve RLMesh-native values.

rlmesh.RemoteVectorEnv

Connect to a vector endpoint and preserve RLMesh-native values.

rlmesh.SandboxEnv

Build an env image and own the container behind a single client.

rlmesh.SandboxVectorEnv

Build an env image and own the container behind a vector client.

rlmesh.Model

Wrap a Python prediction function as a native-value model worker.

rlmesh.RemoteModel

Connect to an already-served model and drive it against an env.

rlmesh.SandboxModel

Run a model policy in its own container (experimental).

rlmesh.ServeOptions

Native serve lifecycle options.

rlmesh.Tensor

Native tensor value used by dependency-free clients.

rlmesh.adapters

Observation/action adapters and contract-based resolution.

rlmesh.spaces

Space wrappers and Gymnasium conversion helpers.

rlmesh.types

Structural protocols and value aliases.

The detailed pages below describe the shared behavior:

Types

The rlmesh.types module defines the structural protocols that EnvServer accepts and the shared value aliases used by dependency-free clients. The protocols are structural, so any object with the right methods satisfies them; you do not subclass anything. Reach for them to type-annotate an environment or a value, or to check what EnvServer expects. For authoring an environment against these protocols see Environments.

Public structural protocols and shared value aliases.

class rlmesh.types.EnvLike[source]

Bases: Protocol[EnvObsT, EnvActT]

Structural protocol for a 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)