# Guardrails

URL: https://www.onsomble.ai/tools/ai-glossary/guardrails

Published: 2026-03-15 00:00:00.000Z

Programmatic constraints placed around AI model inputs and outputs to prevent harmful, off-topic, or policy-violating behavior.

Category: Evaluation & Safety

## Input vs. output guardrails

**Input guardrails** screen user messages before they reach the model — blocking prompt injection attempts, filtering PII, and enforcing topic boundaries. **Output guardrails** validate model responses before they reach the user — checking for toxicity, factual consistency, format compliance, and policy adherence.

## Implementation patterns

-   **Rule-based** — regex, keyword blocklists, format validators. Fast and predictable.
-   **Classifier-based** — lightweight ML models that detect toxicity, PII, or off-topic content.
-   **LLM-as-judge** — use a second LLM call to evaluate whether the output meets quality criteria.
-   **Constitutional AI** — self-critique loops where the model checks its own output against principles.

## Frameworks

Guardrails AI, NeMo Guardrails (NVIDIA), and Anthropic's built-in safety layers are the main options. Many teams also build custom guardrail pipelines tailored to their domain.

## Why it matters

Guardrails are how you ship AI to production without anxiety. They are the safety net between a capable-but-unpredictable model and real users.

## Related terms

- [Hallucination](https://www.onsomble.ai/tools/ai-glossary/hallucination)
- [Observability](https://www.onsomble.ai/tools/ai-glossary/observability)

## Related Radar topics

## Related articles

### [Gaslighting Your AI Into Better Results: What the Research Actually Shows](https://www.onsomble.ai/blog/high-stakes-prompting-llm-quality)

A Reddit post about telling Claude you work at a hospital went viral. Turns out there's actual research explaining why this works across all LLMs.

Rosh Jayawardena · Published 2026-01-29T12:00:00+00:00 · Updated 2026-08-02T12:12:41.52786+00:00 · 8 min

### [The Productivity Lie: Why AI Made Me Slower Before It Made Me Faster (and the 3 techniques that finally fixed it)](https://www.onsomble.ai/blog/the-productivity-lie-ai-made-me-slower)

A founder’s honest take on why AI can slow experienced developers down (METR found a 19% slowdown), why it feels faster, and the three techniques—prompt engineering, context engineering, and workflow engineering—that actually improved my output.

Rosh Jayawardena · Published 2025-12-14T12:00:00+00:00 · Updated 2026-08-02T12:12:41.52786+00:00 · 9 min
