Skip to main content

strands-phm-guard

Deterministic physics/bounds intervention for Strands Agents — validates tool-call arguments against a rule table before execution. No model in the loop, no external API; verdicts are recomputable from inputs alone.

The rule-table scorer behind this package is the same implementation merged into microsoft/PyRIT (PR #3507) and published on Dify Marketplace as phm-physics-check.

What it catches

Argument Value Verdict
speed 4e9 m/s VETO — exceeds c
power -50 W VETO — negative
rpm inf VETO — not finite
speed 100 m/s PASS

Install

pip install strands-phm-guard

Use (Strands Agents SDK >= 1.64)

from strands_phm_guard import PhysicsGuard

guard = PhysicsGuard(mode="deny")   # or mode="guide" for soft correction

# pass via Agent(interventions=[guard]) - see Strands interventions docs

Three-state exit:

  • PASS → Proceed() (tool call dispatched)
  • DEGRADE → Guide(message=...) (model gets the violation list and can self-correct)
  • VETO → Deny(reason=...) (physically impossible call blocked before execution)

Stats are exposed as recomputable counters: guard.stats.as_dict().

Tests

pip install phm-lite-check pytest
pytest tests/ -q

50 tests, no network, fully deterministic.

MHS-style hardware action guard (v0.2.0)

New in 0.2.0: a rule-table guard aligned with the Model Hardware Standard (MHS) research-preview driver model — AI agents operate physical devices through read/write primitives ("get temperature", "set temperature"). Before such a command reaches hardware, check_device_command validates it deterministically:

  • Absolute-zero floor: temperature writes below 0 K / -273.15 °C / -459.67 °F are flagged (unit-aware).
  • Device envelopes: per-parameter safety ranges (pH 0–14, humidity 0–100 %, pressure, voltage, RPM, ...) — out-of-range writes are flagged with the envelope that fired.
  • Command shape: write commands carrying no value, read commands carrying a payload, unknown actions, empty parameters, and unit/param mismatches are all flagged.
  • Non-finite rejection: NaN/±inf writes never pass.
  • Audit chain: SHA-256 verdict chain over (rule inputs → verdict), recomputable offline.
from strands_phm_guard.mhs import check_device_command, MHSActionGuard

check_device_command("write", "temperature_c", -300.0)
# -> ['temperature_c=-300.0 is below absolute zero (envelope temperature_c: [-273.15, 2000.0])']

guard = MHSActionGuard(mode="deny")   # or "guide"; denies/guides only device-shaped calls

This is an independent, deterministic implementation aligned with publicly described MHS concepts (read/write primitives, device safety limits); it is not an official SDK and implements no Anthropic protocol internals.

Scope note

This is a thin rule-table layer: it validates numeric argument bounds (speed-of-light ceiling, negative-physical-quantity rejection, non-finite rejection, configurable per-argument hard limits). It does not parse natural language and does not call any model.

Related proposal: strands-agents/harness-sdk#5934.

Metadata

Release files for strands-phm-guard 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for strands-phm-guard 0.2.0
File Interpreter ABI Platform Actions
strands_phm_guard-0.2.0-py3-none-any.whl Python 3 none any Details for strands_phm_guard-0.2.0-py3-none-any.whl

Release files / strands_phm_guard-0.2.0-py3-none-any.whl

Download URL strands_phm_guard-0.2.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e6e7aa4a9ea6bd57b085628280fe0ee8d5d8660928fdc09979a43b917d35d87
BLAKE2b-256 checksum
How to use checksums
1e54f0ef1c3750544b9b87cc517ccda7f987074407866bb96a655bf82eae6be1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Security for strands-phm-guard 0.2.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page