Manages the recording of event invocations and provides simple event routing functionality. There is one EventService instance in every agent-environment loop, provided by the AgentEnvironmentContext.
Within the environment the richer routing functionality provided by PubSub should be utilized, rather than directly interacting with this class.
TopicInfo(interface_class: Type[T], scope: maze.core.events.event_service.EventScope, proxy: T)¶
internal class to keep track of the topic state, including the collected events
clear_events() → None¶
Notify this service about the start of a new step. This should only be called by the AgentEnvironmentContext.
Clears all collected events and notifies all registered scopes.
create_event_topic(interface_class: Type[T], scope: maze.core.events.event_service.EventScope = None) → T¶
Create a proxy instance of the event interface, which can be used conveniently to publish events. Returns an existing proxy, if it has been created before.
interface_class – The class object of an abstract interface that defines the events as methods.
scope – Every event topic can be bound to a single scope, e.g. a certain PubSub instance, to ensure that all events of the topic interface_class will be received by this PubSub instance.
A proxy object, dynamically derived from the passed interface_class, that can be used to trigger events.
iterate_event_records() → Generator[maze.core.events.event_record.EventRecord, None, None]¶
A generator to iterate all collected events