pub trait RuntimeHooks: Send + Sync {
Show 15 methods
// Provided methods
fn env_connected<'life0, 'async_trait>(
&'life0 self,
_event: EnvConnectedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn model_connected<'life0, 'async_trait>(
&'life0 self,
_event: ModelConnectedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn session_started<'life0, 'async_trait>(
&'life0 self,
_event: SessionStartedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn episode_started<'life0, 'async_trait>(
&'life0 self,
_event: EpisodeStartedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn episode_completed<'life0, 'async_trait>(
&'life0 self,
_event: EpisodeCompletedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn action_received<'life0, 'async_trait>(
&'life0 self,
_event: ActionReceivedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn transform_action<'life0, 'async_trait>(
&'life0 self,
event: ActionReceivedEvent,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Bytes>>, HookError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn step_completed<'life0, 'async_trait>(
&'life0 self,
_event: StepCompletedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn observation_emitted<'life0, 'async_trait>(
&'life0 self,
_event: ObservationEmittedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn transform_observation<'life0, 'async_trait>(
&'life0 self,
event: ObservationEmittedEvent,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Bytes>>, HookError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn session_ended<'life0, 'async_trait>(
&'life0 self,
_event: SessionEndedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn on_telemetry<'life0, 'async_trait>(
&'life0 self,
_event: TelemetrySnapshotEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn session_failed<'life0, 'async_trait>(
&'life0 self,
_event: SessionFailedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn log<'life0, 'async_trait>(
&'life0 self,
_event: LogEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn relay_advisory<'life0, 'async_trait>(
&'life0 self,
_event: RelayAdvisoryEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Callbacks the driver fans out around the reset -> predict -> step loop.
Lifecycle, progress, and log hooks are best-effort: the driver logs a failure
and keeps the route moving. The two transform hooks
(Self::transform_action, Self::transform_observation) are fatal — a
failed transform leaves the next wire payload undefined, so the route fails
and shuts down. One shared instance serves every concurrent route, so each
event carries its route/session identity inline.
Provided Methods§
fn env_connected<'life0, 'async_trait>(
&'life0 self,
_event: EnvConnectedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn model_connected<'life0, 'async_trait>(
&'life0 self,
_event: ModelConnectedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn session_started<'life0, 'async_trait>(
&'life0 self,
_event: SessionStartedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn episode_started<'life0, 'async_trait>(
&'life0 self,
_event: EpisodeStartedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn episode_completed<'life0, 'async_trait>(
&'life0 self,
_event: EpisodeCompletedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn episode_completed<'life0, 'async_trait>(
&'life0 self,
_event: EpisodeCompletedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
The last event under its episode id: no observation or step of that
episode follows it. Under NEXT_STEP autoreset the ended episode is
observed and stepped once more (the autoreset step) before this fires.
fn action_received<'life0, 'async_trait>(
&'life0 self,
_event: ActionReceivedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn transform_action<'life0, 'async_trait>(
&'life0 self,
event: ActionReceivedEvent,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Bytes>>, HookError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn transform_action<'life0, 'async_trait>(
&'life0 self,
event: ActionReceivedEvent,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Bytes>>, HookError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Fatal hook: a failed transform leaves the next action payload undefined, so the route fails rather than send something undefined to the env.
fn step_completed<'life0, 'async_trait>(
&'life0 self,
_event: StepCompletedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn observation_emitted<'life0, 'async_trait>(
&'life0 self,
_event: ObservationEmittedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn transform_observation<'life0, 'async_trait>(
&'life0 self,
event: ObservationEmittedEvent,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Bytes>>, HookError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn transform_observation<'life0, 'async_trait>(
&'life0 self,
event: ObservationEmittedEvent,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Bytes>>, HookError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Fatal hook; see Self::transform_action.
fn session_ended<'life0, 'async_trait>(
&'life0 self,
_event: SessionEndedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn on_telemetry<'life0, 'async_trait>(
&'life0 self,
_event: TelemetrySnapshotEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_telemetry<'life0, 'async_trait>(
&'life0 self,
_event: TelemetrySnapshotEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Live telemetry push, best-effort. A background ticker streams a Window
snapshot (the live tier, cleared each RuntimeLimits::telemetry_window)
while the session runs; one final cumulative Session snapshot is
delivered at session end (the durable tier, also returned on
RuntimeReport.telemetry). Branch on event.snapshot.horizon for window
vs session. Dispatched from a separate task, so this may run concurrently
with the other hooks — do not assume serialized delivery.
fn session_failed<'life0, 'async_trait>(
&'life0 self,
_event: SessionFailedEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn log<'life0, 'async_trait>(
&'life0 self,
_event: LogEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn relay_advisory<'life0, 'async_trait>(
&'life0 self,
_event: RelayAdvisoryEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn relay_advisory<'life0, 'async_trait>(
&'life0 self,
_event: RelayAdvisoryEvent,
) -> Pin<Box<dyn Future<Output = Result<(), HookError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Best-effort; see RelayAdvisoryEvent.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".