Skip to content

strands.vended_interventions.hitl.classifier

Built-in LLM risk classifier for the HumanInTheLoop handler.

Uses an inner agent with structured output to evaluate whether a tool call requires human approval based on risk criteria.

@dataclass
class ClassifierResult()

Defined in: src/strands/vended_interventions/hitl/classifier.py:21

Result from a classifier evaluation.

@runtime_checkable
class HumanInTheLoopClassifier(Protocol)

Defined in: src/strands/vended_interventions/hitl/classifier.py:29

Callable (sync or async) that decides whether a tool call requires human approval.

def __call__(event: BeforeToolCallEvent,
**kwargs: Any) -> ClassifierResult | Awaitable[ClassifierResult]

Defined in: src/strands/vended_interventions/hitl/classifier.py:32

Evaluate whether a tool call requires human approval.

Arguments:

  • event - The tool call event under evaluation.
  • **kwargs - Additional keyword arguments for future extensibility.

Returns:

ClassifierResult indicating whether approval is required.

@dataclass
class LLMClassifierConfig()

Defined in: src/strands/vended_interventions/hitl/classifier.py:46

Configuration for the built-in LLM risk classifier.

Arguments:

  • system_prompt - Risk criteria prompt. Defaults to a general-purpose risk prompt.
  • model - Model for risk evaluation. Defaults to the parent agent’s model.