Skip to main content

Guardian Agent Runtime

Guardian Agent Runtime

CI Python License

Guardian checks an agent's proposed tool call against its permissions, runtime policy and current system state before dispatch. It signs a record linking the decision to the tool result and any observations of what actually changed.

A file worker can acknowledge a write and leave the file untouched. It can also commit the write and then report an error. The offline pilot reproduces both cases and lets you inspect the evidence for each outcome.

Run the observed-outcomes pilot

From a shell with Python 3.12 or later installed, run the following on macOS or Linux. The pilot runs locally without a model account.

python3 -m venv .venv
. .venv/bin/activate
python -m pip install guardian-runtime-assurance==0.5.0
guardian-study --output pilot

The command prints scores for the file worker and a simulated joint. It writes the individual decisions to pilot/report.json and a signed example from each backend to pilot/file/ and pilot/joint/. Use a new output directory for each run.

Pilot result. With the same recorded observations, Guardian and a simple checker agreed on every verdict. Each correctly resolved all 52 claims the protocol predicted were answerable, returned unknown for 74 of 126 decisions and made zero false confirmations. Twelve of the unknowns were actual violations. Guardian's signed record lets another party verify which authorised operation produced each observation. The experiment covers one implementation per backend.

Two-page research note · Study protocol · Case-level results · Integrate a tool or run an Inspect solver · Citation

Published v0.4.1 baseline

Version 0.5.0 includes the pilot and Inspect task. For the earlier published benchmark, install the pinned PyPI distribution.

python -m pip install guardian-runtime-assurance==0.4.1

The Python import is guardian_runtime. The similarly named PyPI project guardian-agent-runtime has a different publisher. Release notes · Migration notes · Publication status

Run the offline demonstration after installing the checkout:

python scripts/showcase.py --output ./guardian-showcase

The eight synthetic cases cover allowed and denied actions, permit replay, revocation, expired policy, malformed tool output and evidence tampering. Existing output directories are preserved. This is an account-free local simulator test, with no model calls, real actuators or external network actions.

At a glance

flowchart LR
    A[Untrusted agent] --> B[Canonicalization]
    B --> C[Capability authorization]
    C --> D[Declarative runtime policy]
    D --> E[Independent safety invariants]
    E --> F[Short-lived signed permit]
    F --> G[Single-use tool gateway]
    G --> H[Mission simulator or local sandbox]
    G --> N[Composed privileged action]
    N --> B
    G --> I[Signed hash-chained evidence]
    I --> J[Signed terminal checkpoint]
    J --> K[Independent verifier]
    L[Adversarial search] --> A
    L --> M[Trace minimization and hardening evaluation]
    M --> D

The Guardian is logically separate from the agent. The agent does not receive direct privileged tool authority in the Guardian architectures.

Results snapshot

The checked reference suite uses five fixed seeds, 26 fixed adversarial scenarios, 24 seeded adversarial scenarios per seed, and 11 benign tasks.

Architecture Attack success Critical action success Benign completion Tamper detection
No Guardian 1.000 1.000 1.000 0.000
Static ACL 0.940 ± 0.000 0.867 ± 0.027 1.000 0.000
Guardian initial 0.228 ± 0.052 0.000 1.000 1.000
Guardian hardened 0.000 0.000 1.000 1.000

These are results from the bundled deterministic local benchmark. They do not establish protection against unknown attacks or production compromise.

The static ACL is intentionally fairer than a broad allowlist. It contains only the tool and action pairs required by the benign workload, including proxy_call because the benign suite contains one legitimate scoped proxy read. It still lacks parameter bounds, runtime state checks, nonce semantics, delegation, nested resource authority, and signed evidence.

Attack success by architecture

Main negative results

The repository deliberately preserves cases where the approach fails or where stronger policy harms utility.

  • The initial Guardian permits a confused-deputy route through proxy_call because valid outer authority does not constrain hidden nested authority.
  • Even in the hardened architecture, the capability layer alone authorizes 0.343 ± 0.062 of adversarial action proposals before policy and invariant checks. The zero measured hardened attack-success rate therefore depends on layered enforcement rather than capabilities alone.
  • A deliberately overfit hardening rule that blocks only the observed secret_read route still permits network_call and actuator_set proxy routes.
  • An aggressive policy that blocks all network actions also blocks the legitimate mock-network task.
  • Execution-time policy checking blocks the original secret-read permit forgery. Signing-key compromise still permits a policy-allowed write without matching capability authority, so protected signing keys remain a required assumption.
  • A lower-level tool that performs an undeclared side effect can escape the Guardian's model of that tool's behavior.

Machine-readable results are in results/negative_results.json.

Reference monitor

The central decision path is implemented in src/guardian_runtime/guardian/monitor.py.

capability_ok, capability_reason = self.capabilities.validate(
    normalized, now, consume=False
)
policy_ok, policy_reason, rule_id = self.policy.evaluate(
    normalized, state, now=now, runtime=self.policy_runtime
)
invariant_ok, invariant_reason = self.environment.check_invariants(normalized)

Only after all three checks pass does the runtime reserve the capability nonce and invocation budget and issue a signed execution permit.

The permit is:

  • bound to the normalized request hash
  • bound to subject and session
  • bound to policy version and runtime-manifest hash
  • bound to the observed runtime-state version
  • short lived
  • single use
  • rejected if the capability or any delegation ancestor has been revoked or expired

The gateway rechecks state-dependent invariants immediately before execution.

Concurrent calls through one runtime are serialised across authorization and execution, including recursive proxy calls. The gateway checks and executes a private copy of the request, so later changes to a caller's parameter dictionary cannot change an authorised action. This protects the in-process mediation path; tools and direct access to simulator state remain trusted.

Capability model

Capabilities constrain:

  • subject identity
  • session scope
  • tool and action scope
  • resource scope
  • allowed and prohibited parameters
  • parameter bounds and enumerations
  • validity interval
  • invocation budget
  • purpose
  • nonce reuse
  • delegation depth
  • revocation

Delegated capabilities are checked conservatively. A child cannot remove a required parent parameter, remove a parent purpose restriction, broaden wildcard scope, restore a prohibited parameter, extend validity, or increase invocation authority.

Parent revocation invalidates descendants. Invocation and nonce budgets are also enforced through the delegation lineage, preventing sibling capabilities from multiplying parent authority.

Declarative policy

Policies are YAML and fail closed on unknown fields, duplicate YAML keys, malformed definitions, and invalid constraint types. The policy engine supports:

  • allow and deny rules
  • escalation rules
  • subject, session, tool, action, resource, parameter, state, and purpose constraints
  • temporal validity
  • rate limits
  • forbidden action sequences
  • separation-of-duty constraints
  • resource budgets
  • emergency-stop behavior

Authorization and environment safety remain separate checks.

Numeric limits must be finite, and counters and validity times must be integers rather than booleans or fractional values. Resource budgets use exact rational accumulation of the supplied decimal values, preventing small charges from disappearing when added to a large total. Invalid numeric or Unicode requests are rejected before execution and retained as diagnostic audit evidence.

The runtime also emits opt-in structured operational events through Python logging. JsonEventFormatter produces one JSON object per record and intentionally excludes request parameters. The signed evidence chain remains the authoritative security audit record.

Execution evidence

Each mediated request produces an Ed25519-signed, hash-chained event containing the requested and normalized action, decision, reason, policy version, capability identifier, runtime-manifest hash, result digest, sequence number, and previous-event hash.

Malformed verifier input produces a verification failure or input error. Cyclic, excessively nested or otherwise unsupported request and tool-output values are represented by explicit diagnostic markers so they cannot erase an audit event. These markers describe invalid values and do not reconstruct the original Python objects. Tool errors and interruptions after an execution attempt are recorded; the permit remains consumed because the tool may already have performed a partial action.

A raw hash chain can detect modification, reordering, replay, and deletion from inside the chain. It cannot by itself prove that the final event was not removed. Guardian therefore exports a signed terminal checkpoint containing the event count and terminal hash.

The independent verifier validates both the event chain and checkpoint, which makes tail truncation relative to that checkpoint detectable as long as the signing key remains trustworthy. Detecting rollback to an older, previously valid signed bundle requires an external freshness anchor or retained latest-checkpoint state and is outside the current verifier.

Verify an evidence bundle with:

guardian-verify evidence.json \
  --public-key '<base64-ed25519-public-key>' \
  --policy-version '1.2-hardened'

Legacy raw event arrays can be checked with --allow-unanchored-events, but the verifier explicitly reports that tail deletion cannot be assessed without a signed checkpoint.

The signed runtime manifest has a separate verifier. Supply a trusted public key out of band rather than trusting a key found only inside the manifest file:

guardian-verify-manifest results/runtime_manifest.json \
  --public-key '<base64-ed25519-public-key>'

Adversarial benchmark

The fixed suite includes:

  • unauthorized privileged actions
  • prompt and tool-output manipulation
  • confused-deputy behavior
  • privilege escalation
  • expired capabilities
  • nonce replay
  • signed-permit replay
  • revocation after authorization
  • parameter smuggling
  • malformed requests
  • canonicalization ambiguity
  • unauthorized action composition
  • policy modification
  • evidence modification
  • evidence tail deletion
  • mock-secret access
  • stale-state actions
  • TOCTOU state changes
  • compromised-agent actions
  • unsafe actions hidden in plans
  • rate-limit evasion
  • delegation escalation
  • blocked-tool route-around attempts

Seeded adversarial generation adds parameter and nested-authority cases under fixed random seeds.

The prompt_injection, indirect_prompt_injection, and tool_output_poisoning scenarios include a deterministic offline ManipulatedAgent. The same agent proposes a benign action without the hostile trigger and a prohibited action when hostile prompt or tool-output context is present. This makes the manipulation step explicit and reproducible, but it is not a language-model prompt-injection benchmark.

evidence_completeness measures external mediated requests that leave at least one evidence event, with recursive nested evidence capped at one covered external request. capability_overprivilege_rate measures the fraction of adversarial action proposals whose presented capability alone authorizes the canonical request before policy and invariant checks. policy_coverage measures the fraction of external requests that reach an explicit policy rule. Internal recursive mediation does not inflate either coverage metric.

Evidence coverage matches records to each request individually. Capability-only measurements exclude lifecycle, audit-tamper, delegation and rate-window harnesses. Benign completion checks every requested step against its observed task postcondition. The result records the tool acknowledgement separately. Latency measurements exclude runtime construction and request preparation.

All execution is confined to bundled local simulators. The network tool records mock:// targets and does not perform external networking.

Defensive hardening

The hardening experiment performs a bounded defensive loop:

fixed and seeded adversarial search
    ↓
reproduce successful bypasses
    ↓
minimize each successful trace
    ↓
generalize a reviewed defensive candidate
    ↓
run the attack search again
    ↓
run the complete benign workload again
    ↓
retain only if security improves without measured utility loss
    ↓
persist minimized cases as executable regression inputs

The checked hardening search uses the 26 fixed scenarios plus 36 generated scenarios with a fixed search seed. It finds 17 manifestations of the initial nested-authority flaw and minimizes them into 4 executable regression classes. The generated candidate requires an explicit nested capability and routes every composed privileged action back through Guardian authorization, policy evaluation, invariants, permit issuance, and evidence generation. Legitimate proxy use remains available because the nested request must carry its own appropriately scoped capability. The candidate is evaluated against the full adversarial and benign search workloads before retention.

The loop does not silently rewrite production policy. A candidate is retained only if it improves the measured security result, introduces no new benchmark failures, does not reduce benign completion, and is semantically identical to the reviewed file configs/guardian/hardened.yaml. results/generated_regressions.json is consumed directly by the regression test suite.

Hardening bypass elimination

High-consequence testbed

The primary deterministic simulator represents a spacecraft-like autonomous platform with telemetry, payload pointing, power allocation, maneuvering, activity scheduling, safe mode, software changes, and restricted command channels.

Hard invariants include bounded maneuver authority, bounded pointing and power envelopes, safe-mode restrictions, communications-state restrictions, signed software-release requirements, stale-state rejection, and nested scheduled-action checks.

A smaller domain-neutral sandbox provides file, mock-network, actuator, proxy, and mock-secret actions.

No real spacecraft control is implemented.

Formal assurance artifact

formal/guardian.tla models capability scope, bounded delegation, parent revocation, capability and permit expiry, policy predicates, safety predicates, state-bound permits, single-use execution, and evidence generation.

formal/check_model.py is an executable bounded state model run in CI. In the checked model it explores 4,196 reachable states and checks:

  • no execution without sufficient capability authority
  • delegation cannot increase authority
  • revoked or expired capability lineages cannot execute
  • policy-denied and unsafe requests cannot execute
  • state changes invalidate stale permits
  • execution permits are single use
  • every execution has a corresponding evidence record

Run it with:

make formal

CI also runs TLC against formal/guardian.tla and formal/guardian.cfg. The bounded Python model remains a separate executable cross-check rather than a substitute for TLA+ model checking.

Both models assume atomic execution and evidence append. They do not verify Python locking, filesystem durability or equivalence between the models and the implementation; those implementation paths have separate regression tests.

Quick start

Python 3.12 or later is required.

python -m venv .venv
source .venv/bin/activate
make install

Run the complete validation suite:

make check

Run the adversarial benchmark:

make benchmark

Regenerate the checked reference results:

make reproduce

Verify that deterministic outputs reproduce bit for bit:

make verify-reproduce

Measure host-dependent decision-path and end-to-end latency separately:

make latency

Build a wheel and SHA-256 release-artifact checksum file:

make package

Latency output is written under results/local/ and is intentionally excluded from checked deterministic results. The decision-path measurement times authorization without tool execution; the end-to-end measurement includes evidence generation and the local simulator call.

Outputs

make reproduce creates:

results/
├── runs.json
├── reference_summary.json
├── hardening_history.json
├── generated_regressions.json
├── negative_results.json
├── runtime_manifest.json
├── dependency_inventory.json
├── sbom.spdx.json
├── checksums.sha256
└── figures/
    ├── attack_success_by_architecture.png
    ├── benign_completion_by_architecture.png
    ├── hardening_bypass_elimination.png
    ├── safety_utility_frontier.png
    └── tampering_detection_by_architecture.png

Headline numbers in this README are derived from the checked result files. Figures are regenerated from those machine-readable outputs.

Repository layout

guardian-agent-runtime/
├── assets/social/
├── configs/
│   ├── benchmarks/
│   ├── capabilities/
│   └── guardian/
├── docs/
├── experiments/
├── formal/
├── scripts/
├── src/guardian_runtime/
│   ├── adversarial/
│   ├── agent/
│   ├── capabilities/
│   ├── evidence/
│   ├── evaluation/
│   ├── guardian/
│   ├── policy/
│   ├── resources/
│   ├── simulator/
│   ├── tools/
│   └── verifier/
├── tests/
├── results/
├── CITATION.cff
├── Dockerfile
├── Makefile
├── requirements.lock
├── SECURITY.md
└── pyproject.toml

Reproducibility

The deterministic reference suite uses fixed seeds 7, 17, 29, 41, and 53, frozen benchmark configuration, deterministic scenario generation, deterministic reference-only signing keys, an exact reference dependency lock, machine-readable outputs, checksums, and CI reproduction checks. make install, Docker, and CI install the locked package set with dependency resolution disabled and then run pip check, so an omitted dependency fails validation rather than being silently resolved. The signed runtime manifest includes SHA-256 hashes of the selected policy, capability configuration, and packaged Guardian source. The reference summary additionally hashes the research source that defines the implementation, experiments, formal artifacts, and generation scripts. GUARDIAN_BUILD_ID can be set by a release pipeline to record an external commit or build identifier without making the checked reference outputs self-referential.

The Python package carries its reference YAML resources inside the wheel, so build_guardian() works from an installed wheel rather than depending on repository-relative config paths. The checked dependency inventory includes the exact package set and dependency graph for the reference CPython 3.12/3.13 Linux environment, and the generated SPDX SBOM represents project-to-direct and package-to-transitive relationships. CI also performs dependency review and vulnerability auditing. External GitHub Actions used by CI are pinned to verified full-length release commit SHAs rather than movable tags.

Reference signing keys exist only to make the research artifact reproducible. They must not be used as production secrets.

See docs/reproducibility.md.

Assurance boundaries

This repository implements software-signed runtime manifests. It does not claim TPM, TEE, secure-element, or confidential-compute attestation.

The Guardian and simulators currently run in one Python process. A production boundary would require stronger process or memory isolation, protected key storage, stronger supply-chain assurance, and possibly hardware-rooted attestation. The bundled policy and capability YAML parsers do reject duplicate keys and malformed schema input, but this remains a research parser rather than a hardened production parser.

Replay caches, capability nonces and revocations, invocation budgets, policy rate limits, and resource-budget state are process-local. A deployment that keeps signing authority across restarts must persist monotonic security state or invalidate the previous permit/session epoch. This repository does not claim restart-safe replay protection.

Authorization reserves nonce, invocation, rate-limit, and resource-budget authority before a permit is executed. If a caller obtains valid permits and abandons them, those reservations can reduce later availability. The reference implementation chooses conservative one-way reservation over reclaiming authority without a durable transaction protocol.

requirements.lock pins the reference package versions and disables dependency resolution, but it does not pin distribution-artifact hashes. Release-grade dependency artifact provenance remains outside the current reproducibility claim.

Compromised tools, compromised signing keys, compromised host operating systems, covert channels, side channels, and hardware attacks remain important limits or out-of-scope adversaries. The negative-result experiments make two of those boundaries concrete.

See docs/threat_model.md and docs/limitations.md.

What this repository does not claim

The benchmark does not prove deployment safety, solve alignment, establish complete policy correctness, or show protection against arbitrary unknown adversaries.

Zero successful attacks in the checked hardened benchmark means only that no included fixed or seeded scenario bypassed the hardened configuration under the stated simulator and threat assumptions.

The defensive loop is bounded and review-gated. It is not arbitrary autonomous policy synthesis.

Requirements

  • Python 3.12+
  • dependencies pinned in requirements.lock
  • pytest and Hypothesis for validation
  • Ruff and mypy for static checks
  • no cloud API or paid service for the reference benchmark

The checked reference dependency inventory and dependency graph are in results/dependency_inventory.json, with an SPDX 2.3 SBOM in results/sbom.spdx.json.

Cite this repository

For the observed-outcomes pilot, cite version 0.5.0. Citation metadata

Kaczmarek, S. (2026). Guardian Agent Runtime (v0.5.0). GitHub. https://github.com/sylvesterkaczmarek/guardian-agent-runtime

@software{Kaczmarek_2026_Guardian_Agent_Runtime,
  author = {Sylvester Kaczmarek},
  title  = {{Guardian Agent Runtime}},
  year   = {2026},
  url    = {https://github.com/sylvesterkaczmarek/guardian-agent-runtime}
}

License

MIT. See LICENSE.

© Sylvester Kaczmarek · https://www.sylvesterkaczmarek.com

November verified release

Version 0.4.0 includes independent temporal-rule regression checks. See the release notes and the independent review. GitHub release artifacts and PyPI publication have separate verification jobs; check their actual workflow status before assuming package-index availability.

Metadata

Release files for guardian-runtime-assurance 0.5.0

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

Source distribution (sdist)

Source distribution for guardian-runtime-assurance 0.5.0
File Size Uploaded Provenance Actions
guardian_runtime_assurance-0.5.0.tar.gz 1.1 MB With provenance Details for guardian_runtime_assurance-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for guardian-runtime-assurance 0.5.0
File Interpreter ABI Platform Actions
guardian_runtime_assurance-0.5.0-py3-none-any.whl Python 3 none any Details for guardian_runtime_assurance-0.5.0-py3-none-any.whl

Total release size: 1.1 MB

Release files / guardian_runtime_assurance-0.5.0.tar.gz

Download URL guardian_runtime_assurance-0.5.0.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
562a031ae812c88cfca45bf8fc25834f31205345d3eca8436cc57a601d463d2d
BLAKE2b-256 checksum
How to use checksums
621e9194b08889a377f42a4af2176bf2050791241eb19dad10f134225490a87b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Nov 21, 2026.

Transparency log

Release files / guardian_runtime_assurance-0.5.0-py3-none-any.whl

Download URL guardian_runtime_assurance-0.5.0-py3-none-any.whl
Size 84.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b07ed826a42d4f280b8ca3bb53308056d2f4c7d1fef7355d03751b2b5ae877b4
BLAKE2b-256 checksum
How to use checksums
9c93f798570f3565fe7b10daf58051fff3b3085ce1e506d93a9a8569c61b9ccc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.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 Nov 21, 2026.

Transparency log

Security for guardian-runtime-assurance 0.5.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for guardian_runtime_assurance-0.5.0.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 Nov 21, 2026.

Transparency log

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