Guardrails AIguardrails-ai 0.11.0 · Python 3.10+
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
27 small wins to finish your pathNext lesson

The validators that need no model

Lesson 4 read the record one validator left behind. That validator, ValidLength, arrived from PyPI, and nine more like it are one pip install away. This lesson is where they come from and which of them cost nothing to run.

What the hub is now

Guardrails Hub is the catalogue of pre-built checks. For most of the library's life it was a private registry: you ran guardrails configure, pasted a token, and installed a validator with guardrails hub install hub://guardrails/detect_pii. Almost every tutorial online still shows that.

Version 0.11.0 retired it. The Migrating to 0.11.0 page states that the registry and the hosted inference endpoints shut down on 6 August 2026, that validators are now public PyPI packages named guardrails-ai-<name>, and that no token is needed to install one. The registered name of each validator did not change, so only the import line moves.

bash
# the old way, still shown nearly everywhere
guardrails hub install hub://guardrails/valid_length

# the way that works now
pip install guardrails-ai-valid-length

The old import path still works and tells you it is on its way out.

Example
import warnings

with warnings.catch_warnings(record=True) as caught:
    warnings.simplefilter("always")
    from guardrails.hub import ValidLength

hub = next(w for w in caught if "guardrails.hub" in str(w.message))
print(hub.category.__name__)
print(str(hub.message)[:78])

What you actually have installed

The CLI is no help here. guardrails hub list still exists, prints a deprecation notice, reads a registry file that pip never writes, and reports that nothing is installed even when ten validators are. Python's own package metadata is the honest answer.

Example
from importlib.metadata import distributions

names = sorted(dist.metadata["Name"] for dist in distributions()
               if (dist.metadata["Name"] or "").startswith("guardrails-ai-"))

for name in names:
    print(name)

Ten of those are validators. guardrails-ai-types is not a check at all; it is the shared package that holds FailResult and friends, and it arrives as a dependency of everything else.

The ten that need nothing

Most of the interesting entries in the hub carry a machine learning model: toxicity, PII detection, competitor checking, topic relevance. Those download hundreds of megabytes the first time you construct them. These ten do not. They are plain Python, and they are why this course runs offline.

ImportClassChecks that the value
guardrails_ai.valid_lengthValidLengthis between min and max characters
guardrails_ai.valid_rangeValidRangeis a number between min and max
guardrails_ai.valid_choicesValidChoicesis one of a list you supply
guardrails_ai.regex_matchRegexMatchmatches a regular expression
guardrails_ai.ends_withEndsWithends with a given string
guardrails_ai.two_wordsTwoWordsis exactly two words
guardrails_ai.lowercaseLowerCaseis all lower case
guardrails_ai.valid_jsonValidJsonparses as JSON
guardrails_ai.valid_urlValidURLhas a scheme and a host
guardrails_ai.web_sanitizationWebSanitizationcontains no script or markup
Example
from guardrails import Guard
from guardrails_ai.valid_choices import ValidChoices
from guardrails_ai.valid_url import ValidURL

kind = Guard().use(ValidChoices(choices=["ship", "refund", "track"], on_fail="noop"))
print(kind.validate("refund").validation_passed)
print(kind.validate("cancel").validation_passed)

link = Guard().use(ValidURL(on_fail="noop"))
print(link.validate("https://shop.example/orders/8821").validation_passed)
print(link.validate("shop.example").validation_passed)

ValidURL is worth opening, because its name suggests a network call. It is urllib.parse.urlparse and two if statements: a value passes when it has a scheme and a host. Nothing is fetched, which is one less thing that can make your test suite flaky.

Try it yourself
  • Install guardrails-ai-two-words and check "support desk" and "the support desk".
  • Run guardrails hub list in your terminal and compare it with the package list you printed above.
  • Look up one hub validator that does need a model, and read what it downloads before you install it.

Every expert started right here.