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.1.tar.gz (7.4 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.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: openguardrails-0.1.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for openguardrails-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d9f41490359e5d2205c170ae7a4fc8c76883df056d28d16a58a461577e83f8c1
MD5 360b2b0a9509a6584b04ff513b12458a
BLAKE2b-256 618f8f5989299ee0169e822ae757f95849bd4d03d99fcadf0798bcd42f7c3e1b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: openguardrails-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for openguardrails-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9c0d9cc438ac740e1ad03d52cdfc7ff6ba498d6d809c4bafea810159a6182215
MD5 80221fd356964b9278914e3ead0f83ee
BLAKE2b-256 5b02da8a36e21e325e04722efc9508285844c1130d791fbea3f6941b7abf5915

See more details on using hashes here.

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