GuardrailAction

org.llm4s.agent.guardrails.GuardrailAction
See theGuardrailAction companion object
sealed trait GuardrailAction

Actions to take when a guardrail detects a violation.

Guardrails can be configured to respond to violations in different ways depending on the use case and severity of the detected issue.

Example usage:

// Block on prompt injection (security critical)
val injectionGuard = PromptInjectionDetector(onFail = GuardrailAction.Block)

// Fix PII by masking (privacy preserving)
val piiGuard = PIIDetector(onFail = GuardrailAction.Fix)

// Warn on low-severity issues (monitoring)
val lengthGuard = LengthCheck(1, 10000, onFail = GuardrailAction.Warn)

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Block
object Fix
object Warn
In this article