This class keeps track of services that can be employed by all objects of the agent-environment loop.
Currently the context is populated by
Event service: Acts as backend of the PubSub service, collects all events from the env. The event service can also be directly facilitated by components outside the environment (e.g. agent, heuristics, state/observation mapping)
Episode ID: Generates and keeps track of the current episode ID Episode IDs are used for connecting logged statistics, events and recorded trajectory data together, making analysis and drill-down across these different levels possible.
Step ID: Tracks ID of the core env step we are currently in. Helps wrappers recognize core env steps in multi-step scenarios.
clone_from(context: maze.core.env.environment_context.EnvironmentContext) → None¶
Clone environment by resetting to the provided context.
context – The environment context to clone.
Get the episode ID.
Episode ID is a UUID generated in a lazy manner, ensuring that if the ID is not needed, the potentially costly random UUID generation is avoided. Once generated, it stays the same for the entire episode and then is reset.
Episode UUID as string
increment_env_step() → None¶
- This must be called after the env step execution, to:
Clear event logs (used for statistics for the current step)
Increment step_id, which is used as env_time by default
pre_step() → None¶
Prepare the event system for a new step.
Checks internally if this has already been done for the current env step, in this case nothing happens.
register_pre_step(callback: Callable) → None¶
Register a function to be called before every single step, just before the events of the previous step are cleared.