pub struct CompositeObserver { /* private fields */ }Expand description
Fan-out StepObserver: forwards every callback to all members and reports
wants_streaming as the OR of its members. Used to run the SSE observer and
the audit observer from the same agent step.
Implementations§
Source§impl CompositeObserver
impl CompositeObserver
pub fn new(members: Vec<Arc<dyn StepObserver>>) -> CompositeObserver
Trait Implementations§
Source§impl StepObserver for CompositeObserver
impl StepObserver for CompositeObserver
Source§fn wants_streaming(&self) -> bool
fn wants_streaming(&self) -> bool
Whether this observer wants token-level streaming. Defaults to
false so the non-streaming AgentRuntime::step path calls
LlmBackend::complete and preserves the exact request wire shape
(no stream: true) every existing caller relied on before streaming
existed. A streaming consumer overrides this to true, which makes
[r#loop::run_step] use LlmBackend::complete_streaming and drive
StepObserver::on_token_delta.Source§fn on_token_delta(&self, chunk: &str)
fn on_token_delta(&self, chunk: &str)
Called with each incremental text chunk of the assistant reply.
Only invoked when
StepObserver::wants_streaming returns true.Source§fn on_tool_call(&self, name: &str, call_id: &str, args: &Value)
fn on_tool_call(&self, name: &str, call_id: &str, args: &Value)
Called just before a tool is dispatched, with its arguments.
Source§fn on_tool_result(&self, name: &str, call_id: &str, result: &Value)
fn on_tool_result(&self, name: &str, call_id: &str, result: &Value)
Called after a tool dispatch succeeds, with the tool’s result.
Source§fn on_tool_failed(&self, name: &str, call_id: &str, error: &Value)
fn on_tool_failed(&self, name: &str, call_id: &str, error: &Value)
Called after a tool dispatch fails or is blocked (e.g. not in the
agent’s allow-list), with the error/reason payload. Additive hook —
see the “Extending this trait” note above.
Source§fn on_llm_call(&self, tokens_in: u64, tokens_out: u64)
fn on_llm_call(&self, tokens_in: u64, tokens_out: u64)
Called after each LLM iteration completes, with that call’s token usage.
Additive hook — lets a streaming consumer surface a per-message LLM/token
trace even for turns that call no tools (the token trail is otherwise
only in the final
AgentOutput.trail, which the SSE stream omits).Source§fn on_guardrail(&self, obs: &GuardrailObservation)
fn on_guardrail(&self, obs: &GuardrailObservation)
Called for every guardrail denial — blocked (Enforce) or merely recorded
(Monitor). Default no-op: only the audit observer forwards these.
Additive hook — see the “Extending this trait” note above.
Auto Trait Implementations§
impl !RefUnwindSafe for CompositeObserver
impl !UnwindSafe for CompositeObserver
impl Freeze for CompositeObserver
impl Send for CompositeObserver
impl Sync for CompositeObserver
impl Unpin for CompositeObserver
impl UnsafeUnpin for CompositeObserver
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request