pub trait TranscriptObserver: Send {
// Required method
fn on_item_appended(&mut self, item: &Item);
}Expand description
Receives full Items as they are appended to the driver’s transcript.
While LoopObserver surfaces operational events (deltas, tool calls,
lifecycle, telemetry), it can’t be reconstructed back into a faithful
transcript on its own — content deltas span partial parts and don’t
carry their parent-Item identity, and historically tool results were
pushed into the transcript with no observer event at all. A
TranscriptObserver is the loss-free counterpart: it fires once per
Item appended, with the full Item shape ready for persistence,
replication, or audit.
Observers are called synchronously from inside the driver, in the
same order items land in the transcript. Compaction-driven transcript
rewrites do not fire on_item_appended — those are signaled by
AgentEvent::CompactionFinished instead.
Register via AgentBuilder::transcript_observer; multiple observers
may be registered and are called in registration order.
§Example
use agentkit_core::Item;
use agentkit_loop::TranscriptObserver;
struct CountingObserver { items: usize }
impl TranscriptObserver for CountingObserver {
fn on_item_appended(&mut self, _item: &Item) {
self.items += 1;
}
}Required Methods§
Sourcefn on_item_appended(&mut self, item: &Item)
fn on_item_appended(&mut self, item: &Item)
Called synchronously every time an Item is appended to the
driver’s transcript, in transcript order.