Skip to main content

OpenGuardrails (OGR) reference runtime — a vendor-neutral protocol for AI agent safety & security. The OpenTelemetry of agent guardrails.

Project description

openguardrails

The OpenGuardrails (OGR) reference runtime — a vendor-neutral protocol for AI agent safety & security. Think OpenTelemetry, but for guardrails: OGR is the neutral wire contract (GuardEventVerdict) and reference Policy Decision Point; 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 an instrumentation package — the OGR analog of opentelemetry-instrumentation-<lib>:

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: openguardrails-0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 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.0.tar.gz
Algorithm Hash digest
SHA256 af3fd3d12374a97642cbf5238264afcba001b1a14b9a4a7b026d33202ae956c3
MD5 e3c9df89b1fd2fe9443c3e75f968abac
BLAKE2b-256 8d93d38b90efb8a140572d96d06faea07a5808022befb2af91942ff362b78f72

See more details on using hashes here.

File details

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

File metadata

  • Download URL: openguardrails-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e438315a5c982f9d4e0c736fbd9ed64a7281bc77ef7159950f2a7a0d6062d3c0
MD5 ec1b4d6801e806639d5d3d751a0b1cca
BLAKE2b-256 1165432b04dbc41b9a2c19a9b94732c51aa92d586ea938fd25697a8c4f18a4ea

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