When to reach for it
- Agents process multimodal data.
- Media content carries compliance or security risks.
- Outputs in multiple modalities must be controlled.
/pattern/multimodal-guardrails/
Text, image, audio, or video inputs and outputs are screened by modality-specific safety classifiers on the way in and on the way out, since a text-only filter is blind to harmful content encoded in other modalities.
In practiceA social-media moderation agent passes every uploaded image through an image-specific content safety classifier before the vision model processes it, blocking unsafe images the text guardrail would never see.
Without itWithout modality-specific guardrails, harmful content encoded in images, audio, or video reaches the model unchecked while text-only safety filters report no violations. See the anti-pattern →
When to reach for it
When it backfires
The tradeoff
Better security in media flows is gained against additional latency and false classifications.
Non-text inputs and outputs pass a safety gate.
A text safety filter is applied to an OCR'd image caption. The harmful content was in the image itself, not the caption — the modality boundary was crossed without a matching filter.
Fix · Mandate a modality-specific filter at every modality transition. Treat 'text filter applied to image' as a configuration error the validator can detect.
A guardrail checks uploaded media on the way in, but the model's own generated image or audio leaves unchecked — so the system can produce exactly the unsafe content it refuses to accept.
Fix · Apply rails on both paths: classify inputs before the model and outputs before delivery (the Llama Guard input/output pattern), per modality.
Keep going
Search patterns, frameworks, and pages.