openguardrails-instrumentation-hermes
Guard a Hermes agent and its
sandbox through the OpenGuardrails (OGR)
protocol. One policy.json enforces across three altitudes — correlated by
guard_id and provenance.
pip install openguardrails-instrumentation-hermes
(pulls in openguardrails, the zero-dependency reference runtime.)
Installing the Python package does not activate a Hermes plugin by itself.
Hermes discovers plugins from $HERMES_HOME/plugins (normally
~/.hermes/plugins) and the plugin must be enabled:
# Development checkout of the OpenGuardrails repository
python -m pip install -e integrations/agent/hermes
mkdir -p "${HERMES_HOME:-$HOME/.hermes}/plugins"
ln -sfn "$PWD/integrations/agent/hermes/src/openguardrails_instrumentation_hermes" \
"${HERMES_HOME:-$HOME/.hermes}/plugins/ogr-guard"
hermes plugins enable ogr-guard
hermes plugins list
Run these commands from the OpenGuardrails repository root, then restart Hermes. This plugin is used for in-process enforcement; Session/Run/Turn reconstruction at the external gateway does not depend on the client plugin.
Why a plugin, not a proxy
Hermes already exposes the interception points OGR needs, so no proxy and no core patching is required for 3 of the 4 altitudes:
| OGR altitude | Hermes surface | Enforce? | Sees |
|---|---|---|---|
gateway (LLM I/O) |
pre/post_api_request hooks |
observe | full prompt + completion |
agent_hook (tool lifecycle) |
pre_tool_call hook |
block | tool name + args, pre-dispatch |
| provenance | post_tool_call hook |
taint | tool results (web/mcp → untrusted) |
sandbox (real exec) |
wraps BaseEnvironment.execute |
block | real argv + secret env keys + cwd |
Only the sandbox altitude needs a wrapper, because Hermes has no
environment-level hook. It is installed from register(), is idempotent, and
fails open if Hermes' layout differs.
Install into a real Hermes
# in a Hermes plugin entrypoint:
from openguardrails_instrumentation_hermes import register
register(ctx) # binds the 4 hooks + installs the sandbox wrapper
Or drop the bundled plugin.yaml into a Hermes plugin dir. Override the policy
with OGR_POLICY=/path/to/policy.json; a Hermes-tuned default ships inside the
package.
What Hermes calls a "sandbox" (and which to use)
There is no syscall sandbox by default. "Sandbox" = a pluggable Environment
backend: local = subprocess.Popen on the host (zero isolation, the
default), docker = docker exec into a container, plus Modal/SSH/Daytona. All
funnel through the one BaseEnvironment.execute() chokepoint we wrap.
Pick the OS-level enforcement backend with OGR_SANDBOX:
OGR_SANDBOX |
Scenario | Enforcement |
|---|---|---|
argv (default) |
quick start | OGR decision only — no OS isolation |
srt |
personal (one laptop, no Docker) | Anthropic Sandbox Runtime: sandbox-exec/bubblewrap enforces the real syscall boundary |
| OpenShell (gateway) | multi-tenant (shared fleet) | container + OPA/Rego egress proxy + gateway credential injection |
The same OGR sandbox policy block compiles to both backends — see
openguardrails_instrumentation_hermes.sandbox.srt and .sandbox.openshell.
No sandbox? OGR degrades, it doesn't fail.
With local there is no isolation boundary, so the only enforcement altitude
is pre_tool_call (inspect argv before exec and block). You keep policy,
provenance, and gateway detection — but lose the adversary-proof view, so a clever
agent can obfuscate argv past the intent check. Run tools under srt/docker so
the sandbox altitude exists and closes that blind spot.
Run the self-test (no Hermes install needed)
python -m openguardrails_instrumentation_hermes.selftest
Drives four scenarios through the real hook signatures: benign / injection-blocked / same-command-trusted / defense-in-depth.
Status
v0.1. Verified against real Hermes (2026-06-28): all four hooks bound, benign
commands executed, credential reads and untrusted-origin curl | bash blocked at
the altitude that saw them first.
Platform reporting with an enrolled identity (optional)
Set OGR_RUNTIME_URL + OGR_API_KEY and the plugin also ships every
GuardEvent to an OpenGuardrails runtime — fire-and-forget, local enforcement
stays authoritative. On first use it enrolls a per-instance Ed25519 key
(POST /enroll, the API key is the bootstrap token) and signs each batch
with OGR-Batch-Signature, so the runtime records this instance's identity
at its enrollment scope instead of an unverified claim
(spec: specification/attestation.md).
Hermes is the "many instances per machine" case: name each one with
OGR_INSTANCE (default default). The instance asserts
subject.agent_id = hermes-<instance> and appears as its own Agent in the
console. OGR_KEYFILE overrides the keypair path
(~/.ogr/hermes-<instance>-ed25519.json), OGR_PRINCIPAL the principal
(default user:<login>).
Metadata
Release files for openguardrails-instrumentation-hermes 0.1.2
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 | |
|---|---|---|---|---|
| openguardrails_instrumentation_hermes-0.1.2.tar.gz | 18.2 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| openguardrails_instrumentation_hermes-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.6 kB
Release files / openguardrails_instrumentation_hermes-0.1.2.tar.gz
| Download URL | openguardrails_instrumentation_hermes-0.1.2.tar.gz |
|---|---|
| Size | 18.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1cb9cbaa3ae42a56de10049800e7399e805d8565e68e39f7244c41cb609c0b28
|
|
BLAKE2b-256 checksum How to use checksums |
e5df20072342bdd9603f8fe1c562c08f0e21851f069d3a196dcd0b8230c1497b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.
Transparency logRelease files / openguardrails_instrumentation_hermes-0.1.2-py3-none-any.whl
| Download URL | openguardrails_instrumentation_hermes-0.1.2-py3-none-any.whl |
|---|---|
| Size | 22.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
86f4eca43b7938e448e4dc284c4ed4c52d5ea3143ed8e104569f28eb2da83529
|
|
BLAKE2b-256 checksum How to use checksums |
b8691c918a44940255460dbb397caf4ed9fe99d6347adaa366abdaf1e10da6af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.
Transparency logSecurity for openguardrails-instrumentation-hermes 0.1.2
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for openguardrails_instrumentation_hermes-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.
Transparency logA 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.