pub struct DefaultGuard { /* private fields */ }Expand description
Default guard implementation
Does not manage its own state; uses RunState information from GuardCtx.
Implementations§
Source§impl DefaultGuard
impl DefaultGuard
pub fn new(config: DefaultGuardConfig) -> Self
Sourcepub fn with_llm_client(
config: DefaultGuardConfig,
llm_client: Arc<dyn LlmProvider>,
) -> Self
pub fn with_llm_client( config: DefaultGuardConfig, llm_client: Arc<dyn LlmProvider>, ) -> Self
Create a new DefaultGuard with LLM client for judge functionality
Trait Implementations§
Source§impl ReactLoopGuard for DefaultGuard
impl ReactLoopGuard for DefaultGuard
Source§fn set_notice(&self, handle: NoticeHandle)
fn set_notice(&self, handle: NoticeHandle)
Receive the engine’s notice handle (Batch E). Called once by the
runtime when the guard is registered, before any run starts. Guards
that want to surface display-only notices (e.g. judge degradation)
store the handle; the default implementation ignores it, so existing
implementers are unaffected.
Source§fn set_provider_source(&self, handle: ProviderHandle)
fn set_provider_source(&self, handle: ProviderHandle)
Receive the engine’s live provider handle. Called once by the runtime
when the guard is registered (next to
Self::set_notice). A guard
that runs LLM calls of its own (e.g. a completion judge) MUST resolve
its client through this handle instead of holding the provider clone
it was built with: a /model swap replaces the engine’s provider, and
a build-time clone keeps answering as the old model (session
20261107_27dc727a). Default: ignore, so existing implementers are
unaffected.Source§fn on_turn<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 GuardCtx,
) -> Pin<Box<dyn Future<Output = GuardDecision> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_turn<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 GuardCtx,
) -> Pin<Box<dyn Future<Output = GuardDecision> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Unified entry point — guard judges the scene and returns a decision.
Source§fn on_tool_call<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 GuardCtx,
) -> Pin<Box<dyn Future<Output = GuardDecision> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_tool_call<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 GuardCtx,
) -> Pin<Box<dyn Future<Output = GuardDecision> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Callback when model calls a tool (new) Read more
Auto Trait Implementations§
impl !Freeze for DefaultGuard
impl !RefUnwindSafe for DefaultGuard
impl !UnwindSafe for DefaultGuard
impl Forget for DefaultGuard
impl Move for DefaultGuard
impl Send for DefaultGuard
impl Sync for DefaultGuard
impl Unpin for DefaultGuard
impl UnsafeUnpin for DefaultGuard
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