Skip to main content

ExecutionObserver

Trait ExecutionObserver 

Source
pub trait ExecutionObserver: Send + Sync {
    // Provided methods
    fn on_started(&self, _spec: &ExecutionSpec) { ... }
    fn on_paused(&self, _queries: &[LlmQuery]) { ... }
    fn on_partial_feed(&self, _query_id: &QueryId, _remaining: usize) { ... }
    fn on_response_fed(
        &self,
        _query_id: &QueryId,
        _response: &str,
        _usage: Option<&TokenUsage>,
    ) { ... }
    fn on_resumed(&self) { ... }
    fn on_completed(&self, _result: &Value) { ... }
    fn on_failed(&self, _error: &str) { ... }
    fn on_cancelled(&self) { ... }
    fn on_log(&self, _entry: &LogEntry) { ... }
}
Expand description

Observer for execution state transitions.

Hooks cross-cutting concerns (stats, logging) without polluting the Execution core.

Provided Methods§

Source

fn on_started(&self, _spec: &ExecutionSpec)

Source

fn on_paused(&self, _queries: &[LlmQuery])

LLM request issued (transition to Paused).

Source

fn on_partial_feed(&self, _query_id: &QueryId, _remaining: usize)

Partial response arrived (not yet complete).

Source

fn on_response_fed( &self, _query_id: &QueryId, _response: &str, _usage: Option<&TokenUsage>, )

A single LLM response has been fed back. usage contains host-provided token counts when available.

Source

fn on_resumed(&self)

All responses arrived, Lua resuming (transition to Running).

Source

fn on_completed(&self, _result: &Value)

Source

fn on_failed(&self, _error: &str)

Source

fn on_cancelled(&self)

Host-initiated cancellation.

Source

fn on_log(&self, _entry: &LogEntry)

A log entry was emitted by the session (Lua print, alc.log, or engine).

Default implementation is a no-op. Override in observers that capture per-session log output (e.g. MetricsObserver).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§