This is an early release preview. You may encounter bugs.
Guardrails logo
Unclaimed

Tool security

Guardrails

Python framework that adds input/output validation guards to LLM applications and generates structured data

A 81/100 GitHub score ? This grade is derived from GitHub signals, not user votes. Open for the full breakdown.
Discussion

01 / Summary

About Guardrails.

Guardrails is a Python framework for making LLM applications more reliable in two ways: it runs input and output guards that detect, quantify, and mitigate specific categories of risk, and it generates structured data from an LLM.

Guards are built from validators — individual risk measures published on Guardrails Hub and installed as Python packages. You compose one or more validators into a Guard and give each an on-fail action, such as raising an exception, then call guard.validate() on text passing into or out of the model. Examples include regular-expression matching, competitor checks, and toxic-language detection.

For structured output, you define the shape you want as a Pydantic model and create a guard from it. The guard then calls the LLM so the response matches that class, either through function calling on models that support it or by adding the expected output schema to the prompt for models that do not.

Guardrails also runs as a standalone service. guardrails start serves configured guards over a REST API, which you can call with the Guardrails client or by pointing an OpenAI SDK at the guard's own endpoint. It can be used with proprietary and open-source LLMs, from Python and JavaScript, and you can write and contribute your own validators.

Validators are moving to standard PyPI packages installed directly with pip, and hosted remote inferencing is being discontinued, with a planned cutoff of August 25, 2026.

  • Input and output guards: validators intercept what goes into and comes out of an LLM
  • Validator hub: pre-built measures for risks such as regex mismatches, competitor mentions, and toxic language, installed as packages
  • On-fail actions: each validator declares what happens when validation fails, for example raising an exception
  • Structured generation: a guard built from a Pydantic model returns output matching that schema
  • Two generation paths: function calling where the model supports it, prompt-injected schemas where it does not
  • Server mode: guardrails start exposes guards over a REST API, reachable from the Guardrails client or an OpenAI-compatible base URL
  • Custom validators: you can write your own and publish them to the hub
  • Language support: usable from Python and JavaScript

02 / Discussion CREDIBILITY-GATED

Discussion

Reading is open to everyone. Posting and voting need a verified identity or a GitHub grade of B or higher.

  • No discussions yet.

03 / Build

Build with Guardrails.

Browse the catalog for frameworks, tools, and harnesses, each scored on real GitHub credibility.

Get Guardrails →

Browse the catalog