pub trait HumanInTheLoopClassifier:
Send
+ Sync
+ 'static {
// Required method
fn classify<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 BeforeToolCallEvent,
) -> Pin<Box<dyn Future<Output = Result<ClassifierResult, BoxError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Decides whether a tool call needs human approval (HumanInTheLoopClassifier).
Implemented for async closures over the event:
use strands::hooks::BeforeToolCallEvent;
use strands::vended_interventions::hitl::{ClassifierResult, HumanInTheLoopClassifier};
let classifier = |event: &BeforeToolCallEvent| {
let deploy = event.tool_use().name == "deploy";
async move { Ok(ClassifierResult::new(deploy).with_reason("deployment requires approval")) }
};
fn takes(_: impl HumanInTheLoopClassifier) {}
takes(classifier);Required Methods§
Sourcefn classify<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 BeforeToolCallEvent,
) -> Pin<Box<dyn Future<Output = Result<ClassifierResult, BoxError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn classify<'life0, 'life1, 'async_trait>(
&'life0 self,
event: &'life1 BeforeToolCallEvent,
) -> Pin<Box<dyn Future<Output = Result<ClassifierResult, BoxError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".