Guardrails AI
Open-source Python framework that runs input/output guards on LLM applications to detect and mitigate risks and to generate structured data from LLMs.
At a Glance
About Guardrails AI
Guardrails is an open-source Python framework from Guardrails AI for building reliable LLM applications. It runs Input/Output Guards that detect, quantify and mitigate specific types of risk, and it can also generate structured data from LLMs. The repository is licensed under Apache 2.0, and the latest listed release is v0.11.0.
What It Is
Guardrails sits between an application and its LLM. Developers wrap model inputs and outputs in a Guard, which applies one or more validators and responds to failures according to a configured on-fail action, such as raising an exception. The same framework can constrain LLM output to a Pydantic model for structured data.
How Guards and the Hub Work
Guardrails Hub is a collection of pre-built validators, each measuring a specific type of risk. Examples in the README include regex matching, competitor checks and toxic-language detection. Several validators can be combined in one Guard, and developers can write custom validators and contribute them to the Hub. Validators are moving to standard PyPI packages that are installed directly with pip.
Structured Data Generation
For structured output, a Guard is created from a Pydantic class. For LLMs that support function calling, Guardrails uses function-call syntax. For LLMs without it, the expected schema is added to the prompt. The README says Guardrails works with proprietary and open-source LLMs.
Deployment: Guardrails Server
Guardrails can run as a standalone Flask-based service started with guardrails start, exposing a REST API. Guards can be called through the Guardrails client or through the OpenAI SDK pointed at the local server. For production, the README recommends Docker with Gunicorn.
Current Status
The README's July 6, 2026 notice says validators are moving to standard PyPI packages and that hosted remote inferencing is being discontinued, with a planned cutoff of August 25, 2026. A migration guide is linked from the README. The README says Guardrails can be used from Python and JavaScript.
Community Discussions
Be the first to start a conversation about Guardrails AI
Share your experience with Guardrails AI, ask questions, or help others learn from your insights.
Pricing
Open Source
Guardrails Python framework (core) released under the Apache License 2.0; free to use, modify and distribute under the license terms.
- Apache License 2.0
- Input/Output Guards for LLM risk detection
- Structured data generation from LLMs
- Guardrails Server (self-hosted REST API via `guardrails start`)
- Validators from Guardrails Hub installable via pip
Capabilities
Key Features
- Input and Output Guards for LLM applications
- Guardrails Hub of pre-built validators
- Combine multiple validators in a single Guard
- Configurable on-fail actions such as raising exceptions
- Structured data generation from LLMs using Pydantic models
- Function calling or prompt-schema optimization for structured output
- Custom validator creation
- Standalone Guardrails Server with REST API
- OpenAI SDK-compatible endpoint
- Works with proprietary and open-source LLMs
- Python and JavaScript support
