Langtrain Logo
Langtrain
PricingDocsBlog
Sign inStart training
All Features
Safety

AI Guardrails.

Ship safer AI — before it reaches your users.

Langtrain Guardrails is a configurable content safety layer for LLM inputs and outputs. Block PII leakage, profanity, prompt injections, and custom policy violations.

4Actions per rule: block, redact, replace, flag
PIIDetected and masked before the model
RegexCustom rules for your own terms

What you get

Everything you need — nothing you don't.

PII Detection

Automatically detect and mask phone numbers, emails, SSNs, Aadhaar, passports, and custom PII patterns before data hits the LLM.

Profanity & Toxicity

Multi-lingual toxicity detection powered by fine-tuned classifiers. Configure sensitivity levels per language.

Custom Regex Rules

Write your own regex-based rules for domain-specific content (e.g., internal product codes, confidential project names).

Prompt Injection Shield

Detect and block adversarial jailbreak attempts and system prompt extraction attacks in real time.

Output Validation

Validate model outputs against your schema. Ensure JSON structure, length limits, and domain compliance before returning to users.

Inline or Sidecar

Deploy as middleware in your API gateway, or use our SDK to wrap any model call. Works with OpenAI, Anthropic, and fine-tuned models.

How it works

From zero to production in 5 steps.

01

Define your policy

Choose from built-in guardrails (PII, profanity, toxicity) and add custom regex or classifier rules.

02

Attach to your pipeline

Wrap your model endpoint with the Langtrain guardrail middleware. One import, zero latency overhead on most rules.

03

Set actions

For each rule, define: block, redact, replace, or flag. Blocked requests return a configurable fallback message.

04

Monitor violations

Every guardrail hit is logged in LangVision with the offending content, rule triggered, and user context.

05

Tune & iterate

Adjust sensitivity thresholds based on false positive rates. Promote rules to production with one click.

SDK snippet

Integrate in minutes.

guardrails_example.py
from langtrain.guardrails import GuardrailsClient

guard = GuardrailsClient(api_key="lt_...")

result = guard.check(
    text="My SSN is 123-45-6789, email me at john@acme.com",
    rules=["pii", "profanity"],
    action="redact"  # or "block" / "flag"
)

print(result.output)
# → "My SSN is [REDACTED], email me at [REDACTED]"
print(result.violations)
# → [{"rule": "pii", "type": "SSN"}, {"rule": "pii", "type": "email"}]
Full SDK Reference

Ready to ship?

Start with the Starter plan for free. No credit card required.

Langtrain Logo
Langtrain

The fine-tuning platform for production LLMs.
Built for builders who demand sovereignty.

  • Github
  • HuggingFace
System status

Product

  • Fine-Tuning
  • PlaygroundNew
  • RL Environment
  • Guardrails
  • AI Agents
  • SDKNew
  • Model Hub
  • Pricing
  • Enterprise

Use Cases

  • Customer Support AI
  • Internal Code Assistants
  • Healthcare & HIPAA
  • Financial Services
  • Legal Document QA
  • E-Commerce & Retail
  • Education & EdTech
  • Manufacturing
  • Research & Data Teams
  • All Use Cases

Resources

  • Documentation
  • Quick Start
  • API Reference
  • Python SDK
  • Node SDK
  • Blog(opens in a new tab)
  • ComparisonsNew
  • GlossaryNew
  • Changelog
  • Status

Company

  • About Us
  • Careers
  • Contact
  • Community
  • Support
Langtrain

© 2026 QUADTREE AI TECHNOLOGIES PRIVATE LIMITED

  • Terms of Service
  • Privacy Policy
  • Cookie Policy
  • Data Processing Agreement
  • Made with ♥love in India