Principle:Guardrails ai Guardrails Validator Installation
| Knowledge Sources | |
|---|---|
| Domains | Package_Management, Validation |
| Last Updated | 2026-02-14 00:00 GMT |
Overview
A package management principle for discovering and installing validator modules from a centralized Hub into the local environment.
Description
Validator Installation is the process of resolving, downloading, and registering validator packages from the Guardrails Hub marketplace. Each validator is an independent Python package identified by a Hub URI (e.g., hub://guardrails/regex_match) that can optionally include version specifiers. The installation process fetches a manifest from the Hub, installs the package via pip, optionally downloads local ML models, and registers the validator's exports so they become importable through the guardrails.hub namespace.
This principle follows a plugin architecture pattern where functionality is distributed as independently installable packages, allowing the framework to remain lightweight while supporting a growing ecosystem of validators.
Usage
Apply this principle whenever you need to add validation capabilities beyond what is available in the base framework. Common scenarios include adding content safety checks, format validation (regex, JSON schema), or ML-based output quality checks.
Theoretical Basis
The installation pipeline follows these stages:
- URI Resolution: Parse the Hub URI to extract validator identifier and optional version constraint
- Manifest Fetch: Retrieve package metadata from the Hub service (dependencies, model requirements)
- Package Install: Use pip to install the validator as a Python package from the Hub's git repository
- Model Download: Optionally download ML model files for validators that run inference locally
- Registration: The validator's __validator_exports__ attribute registers the validator class in the global validators registry