pub struct CompositeReporter { /* private fields */ }Expand description
Fan-out reporter that forwards every AgentEvent to multiple child observers.
CompositeReporter itself implements LoopObserver, so it can be
handed directly to the agent loop. Each event is cloned once per child
observer.
§Example
use agentkit_reporting::{
CompositeReporter, JsonlReporter, StdoutReporter, UsageReporter,
};
// Build a reporter that writes to JSONL, prints to stdout, and tracks usage.
let reporter = CompositeReporter::new()
.with_observer(JsonlReporter::new(Vec::new()))
.with_observer(StdoutReporter::new(std::io::stdout()))
.with_observer(UsageReporter::new());Implementations§
Source§impl CompositeReporter
impl CompositeReporter
Sourcepub fn with_observer(self, observer: impl LoopObserver + 'static) -> Self
pub fn with_observer(self, observer: impl LoopObserver + 'static) -> Self
Adds an observer and returns self (builder pattern).
§Arguments
observer- Any type implementingLoopObserver.
Sourcepub fn push(&mut self, observer: impl LoopObserver + 'static) -> &mut Self
pub fn push(&mut self, observer: impl LoopObserver + 'static) -> &mut Self
Adds an observer by mutable reference.
Use this when you need to add observers after initial construction rather than in a builder chain.
§Arguments
observer- Any type implementingLoopObserver.
Trait Implementations§
Source§impl Default for CompositeReporter
impl Default for CompositeReporter
Source§fn default() -> CompositeReporter
fn default() -> CompositeReporter
Returns the “default value” for a type. Read more
Source§impl LoopObserver for CompositeReporter
impl LoopObserver for CompositeReporter
Source§fn handle_event(&mut self, event: AgentEvent)
fn handle_event(&mut self, event: AgentEvent)
Called synchronously for every
AgentEvent emitted by the loop driver.Auto Trait Implementations§
impl Freeze for CompositeReporter
impl !RefUnwindSafe for CompositeReporter
impl Send for CompositeReporter
impl !Sync for CompositeReporter
impl Unpin for CompositeReporter
impl UnsafeUnpin for CompositeReporter
impl !UnwindSafe for CompositeReporter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more