Guardrails AI is an open-source Python package for turning language-model safety requirements into configurable, real-time checks. Treat these checks like unit tests: they can flag unusual prompts, harmful outputs, or other policy violations before they reach users. section 10.1.3
A practical guardrail workflow can:
- Combine precise patterns with machine-learning classifiers when simple rules cannot reliably detect malicious intent, toxicity, regulated advice, or prompt injection. section 10.1.3
Blocking an unusual request
A validator can assess whether a request is designed to trick the system or elicit a harmful response, requiring only “yes” or “no” from its checking prompt. A separate self-check can ask whether generated output is illegal, unethical, or harmful.

