Guardrails

Examples for input/output safety checks and policy enforcement.

ExampleDescription
DeepKeep AI FirewallCheck input and output with your configured DeepKeep deployment.
Custom GuardrailUse a keyword-based BaseGuardrail pre-hook to reject configured terms.
OpenAI ModerationBlock flagged input with OpenAIModerationGuardrail as a pre-hook, including custom category lists and image moderation.
Output GuardrailReject responses under 20 characters with a post-hook that raises OutputCheckError.
PII DetectionReject or mask the configured PII patterns in input.
Prompt InjectionCheck recognized prompt-injection patterns before model execution.
Mixed Hooks and GuardrailsCombine a logging pre-hook with PIIDetectionGuardrail; blocked runs return RunStatus.error instead of raising.