Skip to main content

Migration: from Guardrails AI

RAIL specs → Trinitite Policies. Reasking → JSON Patch corrections without re-generation.

Why move

Guardrails AI's "reask" pattern recovers from violations by re-generating the model output until validators pass. Under load, that's expensive (extra tokens, extra latency) and not deterministic — the second generation may pass for reasons unrelated to the constraint. Trinitite's Semantic Rectification computes the smallest JSON Patch that lands inside the safe region; no re-generation, sub-400ms.

Concept mapping

Guardrails AI conceptTrinitite equivalent
RAIL spec (XML / Pydantic)Trinitite Policy (text + auto-generated test suite)
ValidatorGuardian (LoRA-trained, schema-aware)
on_fail="reask"Built-in Semantic Rectification — JSON Patch
on_fail="exception"outcome: blocked (HTTP 403)
on_fail="filter"outcome: corrected with span removal
on_fail="fix" (LLM-based)outcome: corrected with deterministic patch

API translation

POST /v1/chat
{
"guardian": "name-format-strict",
"input": [{
  "role": "assistant",
  "content": "Found customer: alice cooper"
}]
}

← 200 OK
{
"outcome": "corrected",
"corrections": [{
  "op": "replace",
  "path": "/0/content",
  "value": "Found customer: Alice Cooper"
}],
"ledger_id": "lg_01HZ2R...",
"latency_ms": 142
}

One round-trip. The Guardian's correction is a deterministic projection to the nearest pre-validated centroid (Title Case format). No re-generation; latency stays sub-400ms even under burst load.

What you keep, what you gain

Keep: your validator intuition (Trinitite still supports schema validation as a policy clause).

Gain: deterministic corrections, Glass Box Ledger, MCP tool governance, CLI Firewall.