1.0.0: remove RAIL spec and all XML machinery (drops lxml)
Target: 1.0.0. Remove the RAIL spec and all XML machinery. Pydantic / JSON Schema become the only ways to declare structured output.
Surface to remove
RAIL schema parsing
guardrails/schema/rail_schema.py(rail_file_to_schema,rail_string_to_schema)guardrails/types/rail.pyguardrails/utils/xml_utils.pyGuard.for_rail(guardrails/guard.py:328),Guard.for_rail_string(guard.py:356), theGuard._railattribute (guard.py:160,guard.py:323), and theAsyncGuardequivalents (async_guard.py:47–48)Validator.to_xml_attrib(guardrails/validator_base.py:415)test_spec.rail(repo root) and the 18.railfixtures undertests/docs/how_to_guides/rail.md
Dependency
lxml>=5.0.0,<7.0.0drops out ofpyproject.toml— one fewer C extension to build wheels against, and a recurring CVE surface gone.
Two things that are not simple deletions
1. constants.xml is an independent lxml consumer and is not about RAIL.
guardrails/classes/templating/constants_container.py parses guardrails/constants.xml, which holds prompt templates (json_suffix_prompt, xml_suffix_prompt, …) — not schemas. Removing lxml requires porting this content to JSON/TOML/Python constants, not deleting it. The xml_suffix_prompt entry itself can go with RAIL. guardrails/utils/misc.py is a third lxml consumer (Element in a random-schema generator; looks test-only — confirm and delete).
2. Validator.rail_alias is the hub registration ABI.
32 references in this repo, but more importantly it is set by register_validator on every published hub validator, and it is what validators_registry is keyed on (validator_base.py:160), what to_dict/from_dict serialize (validator_base.py:470), and what guard configs persisted server-side reference. It also composes the streaming context key (validator_base.py:294).
Renaming it is a breaking ABI change across the entire hub fleet — which now versions independently post hub→PyPI migration. This is the actual sticking point of this issue, not the schema code. Options:
- Keep the name, accept the vestigial "rail" wording (cheapest; slightly embarrassing for a 1.0).
- Rename with
rail_aliasretained as a deprecated property alias, and a defined window before removal.
Also decide the fate of guardrails/datatypes.py's types_registry — the RAIL data-type names (string, integer, …) that register_validator(name, data_type=...) validates against. If RAIL is gone, is that vocabulary still the right one? Note it's load-bearing for the compose-time type check proposed for v1 + v2 (guardrails-ai/guardrails-ai#12).
Wins
- Drops lxml (C extension + CVE surface).
- Collapses three ways to declare output structure (RAIL / Pydantic / JSON Schema) to two.
- Removes the
xml_suffix_promptprompting path entirely.
Source: guardrails-ai/guardrails