These docs describe unreleased changes on main. See the latest release.

Native specs

Native spec and value classes that the Python wrappers expose. The raw bindings behind them are internal.

ServeOptions

ServeOptions(
    *,
    allow_remote_shutdown: bool = ...,
    idle_timeout_seconds: Optional[float] = None,
    drain_timeout_seconds: Optional[float] = None,
    close_timeout_seconds: Optional[float] = None,
    workflow_edition: Optional[str] = None,
    compress_responses: bool = ...,
) -> ServeOptions

Server lifecycle options controlling remote shutdown and timeout behavior.

allow_remote_shutdown

property[source]
property allow_remote_shutdown: bool

idle_timeout_seconds

property[source]
property idle_timeout_seconds: Optional[float]

drain_timeout_seconds

property[source]
property drain_timeout_seconds: Optional[float]

close_timeout_seconds

property[source]
property close_timeout_seconds: Optional[float]

workflow_edition

property[source]
property workflow_edition: Optional[str]

compress_responses

property[source]
property compress_responses: bool

Whether an env server compresses its responses (zstd, else gzip) for a client that accepts them. Off by default; it only pays on a slow link.

Tensor

Tensor(buffer: object, shape: Sequence[int], dtype: str) -> Tensor

Native tensor value carrying a buffer, shape, dtype, and derived layout metadata.

shape

property[source]
property shape: list[int]

dtype

property[source]
property dtype: str

ndim

property[source]
property ndim: int

size

property[source]
property size: int

nbytes

property[source]
property nbytes: int

strides

property[source]
property strides: list[int]

Strides in bytes per dimension, C-order.

device

property[source]
property device: str

Device holding the tensor data. Always "cpu".

buffer

property[source]
property buffer: memoryview

is_contiguous

function[source]
is_contiguous() -> bool

Whether the elements are laid out C-contiguously.

reshape

function[source]
reshape(shape: Sequence[int]) -> Tensor

A tensor with the same elements and a new shape. One dimension may be -1 to infer its size from the element count. Shares the underlying data when this tensor is contiguous.

copy

function[source]
copy() -> Tensor

A deep copy backed by fresh storage.

from_dlpack

function[source]
from_dlpack(obj: object) -> Tensor

Import a tensor from a DLPack capsule or any object implementing __dlpack__. Accepts both legacy and versioned capsules; the elements are always copied into fresh storage and the source capsule is consumed.

tobytes

function[source]
tobytes() -> bytes

EnvContract

Environment metadata returned during a remote client handshake.

id

property[source]
property id: str

env

property[source]
property env: EnvContract

spec

property[source]
property spec: EnvContract

render_mode

property[source]
property render_mode: Optional[str]

num_envs

property[source]
property num_envs: int

metadata

property[source]
property metadata: dict[str, object] | None

observation_space

property[source]
property observation_space: SpaceSpec

action_space

property[source]
property action_space: SpaceSpec

to_dict

function[source]
to_dict() -> dict[str, object]

SpaceSpec

Native space specification used by RLMesh spaces and protocol contracts.

kind

property[source]
property kind: str

shape

property[source]
property shape: list[int]

dtype

property[source]
property dtype: str

to_space

function[source]
to_space() -> Space

to_gym_space

function[source]
to_gym_space() -> object