OpenPrompts
← Back to catalog
NVIDIAGuardrailsSafety & Moderation

AI Defense (NeMo Guardrail)

INPUT RAILS flow ai defense inspect prompt $input_text """Check if the prompt is safe according to AI Defense.""" $result = await AiDefenseInspectActi

# INPUT RAILS

flow ai defense inspect prompt $input_text
  """Check if the prompt is safe according to AI Defense."""
  $result = await AiDefenseInspectAction(user_prompt=$input_text)
  if $result["is_blocked"]
    if $system.config.enable_rails_exceptions
      send AIDefenseRailException(message="Prompt not allowed. The prompt was blocked by the 'ai defense inspect prompt' flow.")
    else
      bot refuse to respond
    abort


# OUTPUT RAILS

flow ai defense inspect response $output_text
  """Check if the response is safe according to AI Defense."""
  $result = await AiDefenseInspectAction(bot_response=$output_text)
  if $result["is_blocked"]
    if $system.config.enable_rails_exceptions
      send AIDefenseRailException(message="Response not allowed. The response was blocked by the 'ai defense inspect response' flow.")
    else
      bot refuse to respond
    abort
Automated safety scan: no suspicious patterns found.

Heuristic text scan aligned to the OWASP Agentic Skills Top 10. How we scan

Provider
NVIDIA
Origin
Official
Type
Guardrails
License
Apache-2.0
Language
English
Added
2026-01-24
#guardrail#nemo#rails#colang