Skip to main content

OpenGuardrails (OGR) reference runtime — a vendor-neutral enforcement protocol for AI agent safety & security: GuardEvent to Verdict, composed under a policy you own.

Project description

openguardrails

The OpenGuardrails (OGR) reference runtime — a vendor-neutral enforcement protocol for AI agent safety & security. Each agent action becomes a GuardEvent, runs past whatever detectors you choose, and gets back a Verdict that can allow, block, or require approval before the action runs. Security/safety vendors plug in behind a single Detector interface, and deployers compose them with one policy.

pip install openguardrails

Zero dependencies (stdlib only).

The contract in 30 seconds

from openguardrails import Runtime, GuardEvent
from openguardrails.detectors.config_rules import ConfigRulesDetector
from openguardrails.detectors.llm_judge import LLMJudgeDetector

rt = Runtime(
    detectors=[ConfigRulesDetector(policy["config_rules"]), LLMJudgeDetector()],
    policy=policy,                       # composition + rules, deployer-owned
)
verdict = rt.evaluate(GuardEvent(...))   # -> allow | block | require_approval | redact | modify
  • GuardEvent — a normalized observation of an agent action (a tool call, an exec, model I/O) plus its provenance (trust labels on the inputs that produced it). The same wire type at every altitude.
  • Detector — the competitive surface. A detector is OGR-conformant if it maps a GuardEvent to a Verdict. Rules, a classifier, or a hosted model — your choice. provider is its stable identity for attribution and benchmarking.
  • Runtime — the PDP: fans out to detectors, composes their verdicts (deny-wins / quorum / first-available), propagates provenance, and correlates altitudes by guard_id so a later observation point can only tighten an earlier decision.

Write a detector (the whole vendor surface)

from openguardrails.detectors import Detector
from openguardrails import Verdict, Category

class AcmeInjectionDetector(Detector):
    provider = "acme.injection"
    handles  = ("tool_call", "exec", "model_output")
    def evaluate(self, ev):
        ...  # rules, classifier, or hosted model
        return Verdict(ev.event_id, ev.guard_id, self.provider, "block",
                       categories=[Category("security.prompt_injection", "security", 0.97)])

Instrument an agent

This is the SDK. To guard a real agent, install a per-target instrumentation package:

Status

v0.1 — reference implementation validating the specification. The wire contract is the product; this runtime is the proof it runs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openguardrails-0.1.2.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openguardrails-0.1.2-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file openguardrails-0.1.2.tar.gz.

File metadata

  • Download URL: openguardrails-0.1.2.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for openguardrails-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4ba6acb9be20862c3378d2b50d912e8c569210577ea1191e3defcbce96668753
MD5 9808eae05afddaefa4b3e636ef012c42
BLAKE2b-256 e699f7f2ef2ffdf2c7ae7675329daa713ef6ad39ce4179e2c04495fc9a39c456

See more details on using hashes here.

Provenance

The following attestation bundles were made for openguardrails-0.1.2.tar.gz:

Publisher: publish.yml on openguardrails/openguardrails-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openguardrails-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: openguardrails-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for openguardrails-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b3722f86241cf8b3ffc3c01f1685fc7b5d30d341c5b4c04a43a73ea2841777d6
MD5 13b395b5409c4a7b65bc0053dfaa5110
BLAKE2b-256 070cc5011ef8d5e5d018fbba70e4322292a6ab5255f009af5651effe21cde18f

See more details on using hashes here.

Provenance

The following attestation bundles were made for openguardrails-0.1.2-py3-none-any.whl:

Publisher: publish.yml on openguardrails/openguardrails-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page