Repository navigation
Built-in validators: the Guardrails AI validators ported natively - #93
Merged
Merged
Conversation
About seventy Guardrails AI validators (Apache-2.0) are rewritten against a small validator interface in detection/validators/, so none needs the guardrails package or a per-validator pip install. Rule checks run offline, model checks load local weights (never at request time), and LLM checks ask the judgment tier, which owns egress and redaction. - Registry with an agentfox.validators entry point; settings-free validators can run as validator.* detectors, the rest as a custom rule of kind "validator" (custom.validators), watched and enforced like any rule. - Dashboard: Policies > Add rule > Use a built-in check, with a settings form drawn from each validator's schema and Try on a sample. - The Guardrails importer maps each validator onto its port with its settings. - rails.hub.* wrappers removed; rails.guardrails_ai kept for your own Guard. - benchmarks/validators compares ours, theirs and both on held-out data; bert_toxic is offered per request, nsfw_text is not (20.6% false positives). - Fix: the dashboard proxy dropped `condition` and `tool`, so value checks could not be saved from the dashboard. Co-Authored-By: Claude <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
# Conflicts: # CHANGELOG.md # api/vendor/agentfox-0.4.0-py3-none-any.whl # demo/redteam-live-lang/vendor/agentfox-0.4.0-py3-none-any.whl
This was referenced Oct 12, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Built-in validators, ported from Guardrails AI
About seventy Guardrails AI validators are now native code in
src/agentfox/capabilities/detection/validators/. None needs theguardrailspackage or a per-validatorpip install. Every source repository is Apache-2.0; credit is inTHIRD_PARTY_NOTICES.mdand in each class'supstream, and the licence text is invalidators/LICENSE-guardrails-ai. Nothing was taken from the unlicensed hub monorepo.How it fits
One small interface (
validators/base.py): name, entity type in our taxonomy, surfaces, a pydantic settings schema, andcheck(text, params, ctx). Validators sit in a registry. Outside packages add their own through theagentfox.validatorsentry point.No settings needed: a validator can run as a
validator.<name>detector, which gives it budgets, obfuscation views, tuning and the Checks screen.Settings needed (system prompt, column list, word list): it runs as a custom rule of kind
validatorthrough the newcustom.validatorsdetector. The rule is watched, enforced, simulated and tuned like any other. A request gets a larger budget only when a rule that needs one applies.Three kinds of check:
A judge that cannot answer raises an error. It never returns clean.
The ports
textstructureallow_egress)sqlweb/disclosurelistsmodelsjudgesUpstream bugs fixed along the way, each noted in the code:
ends_withcompared only the last character.valid_jsonrejected0,falseand[].ban_listspans were off by one.mentions_drugsnever matched names of more than one word.competitor_checkmatched inside longer words.internal_domainsmatched raw substrings.Ours, theirs or both
benchmarks/validators/scores each component once on held-out data, then computes the unions from those predictions. The numbers choose defaults only; they are never used to edit a pattern.injection.classifier(ours)detect_jailbreak(theirs)safety.lexicon(ours)bert_toxic(theirs)nsfw_text(theirs)bert_toxicis now offered as an every-request check.nsfw_textis available only as a rule.The ToxicChat data is CC-BY-NC: it is downloaded to
var/at run time and never committed.Also
on_fail.ValidLength,RegexMatchand others now import instead of being skipped.rails.hub.*(onepip installper validator) is removed.rails.guardrails_aistays for running your own Guard.conditionandtool, so value checks could not be saved from the dashboard.Checks
ruff, import-linter (6 contracts, including a new one: built-in validators are reached through the registry),tsc, vitest 91/91, and the claims checker 46/46 all pass.