Expand description
Human-in-the-loop approval of tool calls.
HumanInTheLoop asks a human before tool calls. By default the agent stops with an
interrupt and the caller resumes it with the answer; give it an ask
callback (or HumanInTheLoopAsk::Stdio) to ask inline instead.
use strands::Agent;
use strands::testing::MockModel;
use strands::vended_interventions::hitl::{HumanInTheLoop, HumanInTheLoopConfig};
let hitl = HumanInTheLoop::new(HumanInTheLoopConfig {
allowed_tools: vec!["read_file".into()],
..Default::default()
});
let agent = Agent::builder()
.model(MockModel::new())
.interventions([hitl])
.printer(false)
.build()?;Structs§
- AskFn
- Collects a human’s answer inline. The answer is
Nonewhen there is none, which denies the call. - Classifier
Result - A classifier’s decision (
ClassifierResult). - Human
InThe Loop - Asks a human before tool calls run (
HumanInTheLoop). - Human
InThe Loop Auto Config - What
HumanInTheLoop::autoaccepts (HumanInTheLoopAutoConfig): how the human is reached and the calls that skip the decision entirely. The approval strategy is the mode’s to choose. - Human
InThe Loop Auto Config Builder - Use builder syntax to set the inputs and finish with
build(). - Human
InThe Loop Config - Settings of a
HumanInTheLoop(HumanInTheLoopConfig). - Human
InThe Loop Config Builder - Use builder syntax to set the inputs and finish with
build(). - LlmClassifier
Config - Settings of the built-in LLM risk classifier (
LlmClassifierConfig).
Enums§
- Classifier
Config - How a
HumanInTheLoopdecides which tool calls need a human (classifier): the built-in LLM risk classifier or a custom classifier. - Human
InThe Loop Ask - How a
HumanInTheLoopcollects answers inline (ask).
Constants§
- HUMAN_
IN_ THE_ LOOP_ NAME - The name of the handler and of the interrupts it raises.
- TRUSTED_
TOOLS_ KEY - The app-state key of the tools trusted for the session.
Traits§
- Human
InThe Loop Classifier - Decides whether a tool call needs human approval (
HumanInTheLoopClassifier).