---
title: Llama Guard (NeMo Guardrail)
type: guardrail
provider: nvidia
category: safety
source: 'https://github.com/NVIDIA-NeMo/Guardrails'
license: Apache-2.0
tags:
  - guardrail
  - nemo
  - rails
  - colang
dateAdded: '2026-05-04'
featured: false
origin: official
language: en
description: >-
  flow llama guard check input $llama_guard_response = await
  LlamaGuardCheckInputAction global $allowed $allowed =
  $llama_guard_response["allowed"] Poli
---

```coffee
flow llama guard check input
  $llama_guard_response = await LlamaGuardCheckInputAction
  global $allowed
  $allowed = $llama_guard_response["allowed"]
  # Policy violations are currently unused, but can be used to better phrase the bot output
  global $llama_guard_policy_violations
  $llama_guard_policy_violations = $llama_guard_response["policy_violations"]

  if not $allowed
    if $system.config.enable_rails_exceptions
      send LlamaGuardInputRailException(message="Input not allowed. The input was blocked by the 'llama guard check input' flow. Please ensure your input meets the required criteria.")
    else
      bot refuse to respond
    abort

flow llama guard check output
  $llama_guard_response = await LlamaGuardCheckOutputAction
  global $allowed
  $allowed = $llama_guard_response["allowed"]
  global $llama_guard_policy_violations
  $llama_guard_policy_violations = $llama_guard_response["policy_violations"]

  if not $allowed
    if $system.config.enable_rails_exceptions
      send LlamaGuardOutputRailException(message="Output not allowed. The output was blocked by the 'llama guard check output' flow. Please ensure your output meets the required criteria.")
    else
      bot refuse to respond
    abort
```
