phm-relay-guardrail
Rule-table-based physics/bounds guardrail for NVIDIA NeMo Relay tool calls — no LLM in the loop. Rejects tool arguments that violate the shipped physics rule table before execution, with three-state verdicts designed to be recomputable from the rule table and the payload.
Part of the PHM-Audit verification stack (also shipping as a Dify Marketplace plugin and an MCP-registry-listed package).
What it catches
| Rule | Example rejected | Example allowed |
|---|---|---|
| Probability bounds | {"probability": 1.8} |
{"probability": 0.7} |
| Share/percent bounds | {"percent_share": 150} |
{"note": "power increased by 150%"} (growth, not share) |
| Mass non-negative | {"mass_kg": -3.0} |
{"energy_eV": -13.6} (binding energy, signed) |
| Speed of light | {"velocity": 5.0e8} (m/s) |
{"velocity": -1.5e3} (direction is fine) |
| Absolute zero | {"temp_c": -300.0} |
{"temp_c": -196.0} |
| NaN/Inf | {"top_k": NaN} |
any finite number |
Design lessons carried over from a maintainer-reviewed upstream implementation (microsoft/PyRIT #3507 — approval there refers to that implementation, not to this plugin): negative energies are legal; growth percentages are not shares; signed velocities are legal; malformed payloads never crash the gate.
NVIDIA maintainer guidance in NeMo-Relay #1690 concerned publishing mechanics (build your own plugin, publish separately) — it is not an endorsement.
Install
Install from source (PyPI release pending):
pip install git+https://github.com/PHM-Audit/phm-relay-guardrail.git
Requires the nemo-relay-plugin SDK (>=1.0.0,<2.0).
Use
Serve as a Relay worker plugin:
python -m phm_relay_guardrail
Or embed in your own worker:
from phm_relay_guardrail import PhmPhysicsGuardrailPlugin
plugin = PhmPhysicsGuardrailPlugin()
# pass to your Relay worker bootstrap / serve_plugin(...)
Runtime configuration (operator-declared, JSON from the plugin record):
{
"rules": {"probability_bounds": true, "nan_reject": true, "speed_of_light": true},
"skip_keys": ["probability"],
"force_keys": {"altitude": "count"}
}
Status
- Rule-table unit tests: 15/15 passing (
tests/test_rules.py) — 15 unit-level cases covering the six rule families above, including signed/boundary cases; not exhaustive - Host end-to-end: smoke-tested against a live
nemo-relayhost pipeline, 3 cases (tests/e2e_host.py) — 1 benign call executed normally, 2 physics-invalid calls (out-of-range probability, NaN) vetoed before the tool ran - PyPI package: pending
- Not affiliated with or endorsed by NVIDIA. Apache-2.0.
Metadata
Release files for phm-relay-guardrail 0.1.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 |
|---|---|---|---|---|
| phm_relay_guardrail-0.1.0.tar.gz | 10.2 kB | Without provenance | Details for phm_relay_guardrail-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| phm_relay_guardrail-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for phm_relay_guardrail-0.1.0-py3-none-any.whl |
Total release size: 20.7 kB
Release files / phm_relay_guardrail-0.1.0.tar.gz
| Download URL | phm_relay_guardrail-0.1.0.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
561432419f1f895ee95c69ba102baf66b994d4bb34503dd8e36aa55ae0219dce
|
|
BLAKE2b-256 checksum How to use checksums |
03f5a563d5fea43b0b358bcc4ceb8840fd4c546da740264c0422d2b11cb6b474
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / phm_relay_guardrail-0.1.0-py3-none-any.whl
| Download URL | phm_relay_guardrail-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4d57c70fe7f81358df51b8c080956ce85f37b4f9fb5f58f29f906d955c55d938
|
|
BLAKE2b-256 checksum How to use checksums |
56b3e2ba8179199135803aebb03ac085496c494ccab02e8f79ad3e808f0fc700
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Security for phm-relay-guardrail 0.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.