Skip to main content
Two complementary safety mechanisms: the safety filter scans LLM responses for harmful content (Art.15), and the HITL gate requires human approval for critical actions (Art.14).

Safety Filter

The safety filter is a post-hook that scans LLM responses against pattern-based rules across 5 categories.

Categories

Severity Weights

Configuration

  • block — throws SafetyViolationError
  • warn — adds findings to response metadata, does not throw
  • log — logs findings, no metadata or throw

SafetyFinding


Human-in-the-Loop Gate

The HITL gate is a post-hook that pauses execution when LLM output matches critical action patterns. A human operator must approve or deny before the response is returned.
If no onGateTriggered callback is configured, the gate auto-denies all matches (fail-safe per Art.14). Always provide a callback in production.

Built-in Rules

4 default rules cover the most critical action categories:

Configuration

Custom Rules

Override built-in rules with hitlGateRules:

Types

Timeout Behavior

  • Default timeout: 5 minutes (300000 ms)
  • On timeout: throws HumanGateDeniedError with reason: 'timeout'
  • On denial: throws HumanGateDeniedError with reason: 'denied'
  • On approval: response passes through with hitlGateTriggered: true in metadata

Error Handling

SafetyViolationError and HumanGateDeniedError reference.

Agent Mode

Circuit breaker for cascading agent failures.