Guardrails helps Python applications validate and shape large language model inputs and outputs. It combines risk validators with utilities to produce structured data from model responses.
Overview
Guardrails is a Python framework for building more dependable AI features on top of large language models. It runs input and output guards that detect, measure, and mitigate specific risk categories, using validators from the Guardrails Hub catalog. Multiple validators can be chained into guards that intercept prompts and model replies before they reach users or downstream systems.
The same toolkit supports structured generation: you define a Pydantic model for the shape you expect, attach it to a Guard, and call the model so responses conform to that schema. For models with function-calling support it uses native function call syntax; for others it augments prompts with the expected schema so outputs stay structured.
Day-to-day setup uses the Guardrails Hub CLI to install validators, compose guards in Python, and run validation around LLM calls. Developers can author custom validators and publish them to the hub. Documentation describes using proprietary and open models, and JavaScript integration is mentioned for teams that need cross-language clients.
For deployments that want a network boundary, Guardrails can run as a standalone Flask service started via the guardrails CLI, exposing a REST API; production notes recommend Docker with Gunicorn. The primary integration path remains embedding guards in application code rather than operating a mandatory hosted SaaS control plane.
Key features
- Input and output LLM guards
- Hub catalog of risk validators
- Structured output via Pydantic models
- Function calling and prompt-based formatting
- Composable multi-validator guards
- Custom validator authoring
- Python and JavaScript client support
- Optional standalone REST server
Use cases
- Screening LLM prompts and responses for policy risks
- Forcing typed JSON-like outputs from models
- Combining multiple validators on one call path
- Publishing organization-specific validators
- Serving guards behind an internal HTTP API
Does the same job as
Guardrails doesn't name these products itself, but its own description shows it does the same job.