rlmesh.adapters.EnvTags
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.
Attributes
Methods
- to_dict()Return a JSON-compatible dict form of these tags.
- to_json()Return these tags serialized as a JSON string.
- to_metadata()Return a metadata mapping fragment carrying these tags.
- from_dict()Build tags from
to_dict()output. - from_json()Build tags from
to_json()output. - from_metadata()Extract tags from env contract metadata, or None when absent.
observation
attribute[source]observation: ObsNodeThe observation tag tree.
action
attribute[source]action: ActionLayout of the action vector accepted by step.
observation_roles
property[source]property observation_roles: ObservationRolesto_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.