openai-guardrails
OpenAI Guardrails: A framework for building safe and reliable AI systems.
Decision gist · record as of 2026-08-14
Yes, if you need to add safety and compliance checks to an OpenAI-based LLM application. The package is actively maintained, has low install friction, uses a permissive MIT license, and offers a drop-in integration pattern that minimizes code changes. It is still in preview (version 0.3.0), so expect potential API changes; verify stability for production use cases before committing to it.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.11+.
- If using the Contains PII guardrail, the spaCy model en_core_web_sm must be downloaded separately before client initialization.
- Low install friction with a pure-Python wheel.
License · maintenance · safety
MIT (permissive) — MIT license (permissive) means you can use, modify, and distribute this package freely in commercial and open-source projects. No copyleft obligations.
last release 2026-07-21 (24 days) · last repo commit 2026-07-21 · 229 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 315,200 downloads/mo, #7,689 on PyPI
Alternatives
Verify before relying
pip install openai-guardrails
from pathlib import Path
from guardrails import GuardrailsOpenAI
client = GuardrailsOpenAI(config=Path("guardrail_config.json"))
chat = client.chat.completions.create(
model="gpt-5",
messages=[{"role": "user", "content": "Hello world"}],
)
print(chat.choices[0].message.content)- Whether the package's evaluation framework (guardrail_evals) is production-ready or still in preview like the main package.
- Performance overhead of guardrail checks on typical LLM request latency.
- Whether custom guardrails beyond the built-in set can be easily defined by users.
What it is and what it does
OpenAI Guardrails is a Python wrapper around OpenAI's client that intercepts and validates LLM requests and responses against configurable safety rules. It provides a drop-in replacement for the standard OpenAI client, letting you add guardrails without rewriting your application code. The package includes built-in checks for content moderation, PII detection, jailbreak attempts, hallucination detection, NSFW content, off-topic prompts, and URL filtering, all configured via JSON.
The package depends on openai, openai-agents, presidio-analyzer, pydantic, and thinc. It integrates with OpenAI's Agents SDK via GuardrailAgent for agent-based workflows and includes an evaluation framework to benchmark guardrail performance on labeled datasets. When a guardrail is triggered, it raises GuardrailTripwireTriggered, allowing you to handle violations gracefully. The spaCy model for PII detection is an optional but documented prerequisite if that guardrail is enabled.
Use it for
- Protect customer-facing chatbots from jailbreak attempts and inappropriate content without modifying core chat logic.
- Detect and mask personally identifiable information in LLM inputs and outputs to meet data privacy compliance.
- Evaluate guardrail effectiveness on labeled datasets and benchmark different model configurations for safety performance.
- Integrate safety checks into OpenAI Agents SDK workflows to ensure agent outputs meet compliance requirements.
- Filter hallucinated or off-topic responses to keep LLM outputs within business scope and factual accuracy.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to add safety and compliance checks to an OpenAI-based LLM application.
The package is actively maintained, has low install friction, uses a permissive MIT license, and offers a drop-in integration pattern that minimizes code changes. It is still in preview (version 0.3.0), so expect potential API changes; verify stability for production use cases before committing to it.
Install
openai-guardrails on PyPI
Before you install
Low install friction with a pure-Python wheel. Active maintenance (last commit 2026-07-21, 24 days old). Requires Python 3.11 or later. The spaCy model for PII detection must be downloaded separately if that guardrail is enabled, which is documented as a prerequisite during client initialization.
Requires Python 3.11+. If using the Contains PII guardrail, the spaCy model en_core_web_sm must be downloaded separately before client initialization.
License in practice
MIT license (permissive) means you can use, modify, and distribute this package freely in commercial and open-source projects. No copyleft obligations.
Quickstart
pip install openai-guardrails
from pathlib import Path
from guardrails import GuardrailsOpenAI
client = GuardrailsOpenAI(config=Path("guardrail_config.json"))
chat = client.chat.completions.create(
model="gpt-5",
messages=[{"role": "user", "content": "Hello world"}],
)
print(chat.choices[0].message.content)
Verify before relying
- Whether the package's evaluation framework (guardrail_evals) is production-ready or still in preview like the main package.
- Performance overhead of guardrail checks on typical LLM request latency.
- Whether custom guardrails beyond the built-in set can be easily defined by users.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.11 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 5 packagesopenai-agentsopenaipresidio-analyzerpydanticthinc |
| Maintenance | Actively maintained 24 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 315,200 / month, #7,689 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Libraries :: Python ModulesTyping :: Typed |
Evidence: openai_guardrails-0.3.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “openai content moderation”
- openai-guardrailsAdds configurable safety and compliance guardrails to LLM…
- azure-ai-contentsafetyDetects harmful content in text and images by classifying them across…
- datarobot-moderationsEnforces content moderation on LLM prompts and responses using…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also guardrails-ai · pydantic-ai-shields · nemoguardrails · guardrails-hub-types · openai-agents · codeshield · guardrails-ai-types · llm-openai-plugin · openlit · deepteam