Guardrails AI
An Apache 2.0 Python framework checks LLM inputs and outputs and generates structured data inside your app or through a self-hosted REST service.

Guardrails AI is an open-source Python validation framework that runs inside your application or as a self-hosted service. It's for developers who need to check LLM inputs and responses before their apps use them. It provides a validation layer around model interactions; it doesn't supply local model inference.
Guardrails Hub provides prebuilt validators for specific risks. Developers can combine them into checks that intercept inputs or outputs, measure problems and apply mitigation. The platform's runtime guardrails cover policy violations, hallucinations and data leakage, with controls that can block problematic responses before users receive them.
The framework also helps generate structured data from LLMs. Pydantic models define the expected fields and shape of a response, giving applications a concrete output contract alongside their risk checks.
The framework uses the Apache 2.0 license. Its standalone server uses Flask and exposes a REST API, so applications can call a separate validation service on infrastructure you control. Hosting that service yourself establishes where the validation layer runs, rather than where the connected LLM processes requests.
Beyond the framework, the broader Guardrails AI platform generates synthetic datasets for fine-tuning, distillation and prompt optimization. Its agent evaluation tools generate test scenarios focused on edge cases and risky outcomes, then measure failure modes.