open-guardrail (Python)
309 guards. Zero dependencies. Pure Python. <0.1ms latency.
Install
pip install open-guardrail
Quick Start
from open_guardrail import pipe, prompt_injection, pii, keyword
pipeline = pipe(
prompt_injection(action="block"),
pii(entities=["email", "phone"], action="mask"),
keyword(denied=["hack", "exploit"], action="block"),
)
result = pipeline.run("user input text here")
if not result.passed:
print(f"Blocked: {result.action}")
# result.output contains masked text when PII is detected
309 Built-in Guards
Security
prompt_injection indirect_injection sql_injection xss_guard secret_pattern invisible_text canary_token encoding_attack data_leakage data_exfiltration path_traversal command_injection ssrf_detect jailbreak_pattern api_key_detect social_engineering unicode_confusable ascii_art data_poisoning prompt_leak semantic_firewall multimodal_safety rag_safety token_smuggling prompt_chaining output_filter_bypass model_denial agent_permission supply_chain_detect instruction_hierarchy context_window_abuse
Privacy — 26 PII Regions
pii pii_kr pii_jp pii_cn pii_th pii_ar pii_in pii_eu pii_de pii_fr pii_br pii_au pii_ca pii_mx pii_sg pii_id pii_ru pii_pl pii_es pii_it pii_tr pii_vn pii_ng pii_za pii_ke pii_eg
Compliance
gdpr_compliance eu_ai_act ai_basic_act_kr isms_p pipa appi pipl hipaa_detect pci_dss_detect sox_compliance ferpa_detect privacy_policy
AI / LLM Safety
hallucination_url reasoning_trace_leak persona_consistency confidence_score content_watermark rate_limit_semantic
Content Safety
toxicity bias hate_speech violence_detect sexual_content self_harm_detect profanity_en profanity_kr profanity_jp profanity_cn
Agent Safety
agent_loop_detect tool_abuse escalation_detect rag_poisoning
Guard Composition
from open_guardrail import compose, when, parallel
# Bundle guards
security = compose("security",
prompt_injection(action="block"),
sql_injection(action="block"),
)
# Conditional execution
long_text_check = when(lambda t: len(t) > 200, toxicity(action="block"))
# Parallel execution
fast = parallel(prompt_injection(action="block"), toxicity(action="block"))
License
MIT
Metadata
Release files for open-guardrail 0.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| open_guardrail-0.11.0.tar.gz | 260.6 kB | With provenance | Details for open_guardrail-0.11.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| open_guardrail-0.11.0-py3-none-any.whl | Python 3 | none | any | Details for open_guardrail-0.11.0-py3-none-any.whl |
Total release size: 803.3 kB
Release files / open_guardrail-0.11.0.tar.gz
| Download URL | open_guardrail-0.11.0.tar.gz |
|---|---|
| Size | 260.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cf68677bd1c2b62aaee71ca557ebe640688600233e5095227fff46f4e3743808
|
|
BLAKE2b-256 checksum How to use checksums |
797a65aacd959cea67e89f1c2fed8c410d29fc1aedc535bcc33492cb8ff0cc8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 11, 2026.
Transparency logRelease files / open_guardrail-0.11.0-py3-none-any.whl
| Download URL | open_guardrail-0.11.0-py3-none-any.whl |
|---|---|
| Size | 542.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a15bce5eda39c39f07d140bb2039b0109eecaafdf0d23214789520382a0588ab
|
|
BLAKE2b-256 checksum How to use checksums |
39bb7221b5698644445ca49058618dc83751a14f5d8e3826f0c53e2071f09e76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 11, 2026.
Transparency logSecurity for open-guardrail 0.11.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for open_guardrail-0.11.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 11, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.