rlmesh.adapters.EnvTags

classfrom rlmesh.adapters import EnvTags[source]

Declarative tags of an environment's observation and action.

EnvTags(observation: ObsNode, action: Action)

observation is a recursive tree whose container type is the runtime container type: a bare leaf (the observation is one space leaf), a dict[str, subtree] (a Dict space), or a tuple of subtrees (a Tuple space). A leaf is an ImageTag, StateTag, TextTag, or Split.

observation

attribute[source]
observation: ObsNode

The observation tag tree.

action

attribute[source]
action: Action

Layout of the action vector accepted by step.

observation_roles

property[source]
property observation_roles: ObservationRoles

The declared observation roles, grouped by kind in declaration order.

Walks the observation tag tree (dict/tuple containers and bare leaves): ImageTag roles land in images; StateTag roles and non-skip Field roles inside a Split land in states; TextTag roles land in texts.

to_dict

function[source]
to_dict()

Return a JSON-compatible dict form of these tags.

The dataclass<->dict shape is built here, then validated and canonicalized by the authoritative Rust codec (the output is always the Rust-canonical form), so Python cannot emit a spec Rust would reject.

to_json

function[source]
to_json()

Return these tags serialized as a JSON string.

to_metadata

function[source]
to_metadata()

Return a metadata mapping fragment carrying these tags.

Merge the result into env contract metadata so remote clients can recover the tags via from_metadata().

from_dict

function[source]
from_dict(data: Mapping[str, Any])

Build tags from to_dict() output.

The input is validated and canonicalized by the Rust codec first, so the Python shape readers below operate on already-valid data.

from_json

function[source]
from_json(payload: str)

Build tags from to_json() output.

from_metadata

function[source]
from_metadata(metadata: Mapping[str, Any])

Extract tags from env contract metadata, or None when absent.

Reads the single v1 metadata key (rlmesh.adapters.v1.env_tags). When a future v2 format lands it ships a new key and reader, restoring a newest-format-first dual read so a newer build still reads an older peer’s v1 tags; that dispatch moves into the Rust codec (the single source of truth) once the PyO3 normalize door lands.