File size: 892 Bytes
5e0b58b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""Environment contracts for embodied Brain-5D experiments."""

from __future__ import annotations

from typing import Protocol, runtime_checkable

from .models import ActionCommand, EnvironmentKind, EnvironmentObservation


@runtime_checkable
class EnvironmentAdapter(Protocol):
    """Reset/step contract shared by simulation, physical, and digital worlds."""

    @property
    def environment_id(self) -> str:
        """Return a stable environment identifier."""
        ...

    @property
    def kind(self) -> EnvironmentKind:
        """Return the environment category."""
        ...

    def reset(self, seed: int | None = None) -> EnvironmentObservation:
        """Start a new episode and return its initial observation."""
        ...

    def step(self, action: ActionCommand) -> EnvironmentObservation:
        """Advance the environment by applying one action."""
        ...