Skip to main content
License: Apache 2.0 The budget your agent can’t raise. A human signs a spend mandate. The agent holds its own key but never the human’s. Every charge is checked fail-closed before execution, and every decision produces a receipt anyone can recompute offline from public material — no mediator signature required. Then an adversary — a live AI model, a human red-teamer, an authored attack file, or a seeded fuzzer — tries to break it, and you watch every attack fail.
Free and Apache-2.0. Install via pip install algovoi-agent-guard (only dependency: cryptography>=42). A TypeScript port is published as algovoi-agent-guard on npm. This is a runnable reference, not a deployed service; no production adoption is claimed. It moves no funds.

Try it

1

Install

2

Run the rogue-agent demo

A forged mandate, a replay, a forged countersign, a ledger rewrite and a foreign payee are each denied or detected, while an honest charge is ALLOWed and recomputes offline. The run ends DEMO PASSED and writes its evidence artefacts to ./demo.
3

Run the red-team

A deterministic attack battery plus a pluggable adversary. Every attack is executed against the real guard, its receipt recomputed offline, and checked against an independent policy predicate — the security claim never rests on the adversary’s verdict.
A commented, self-contained starter lives at examples/quickstart.py: issue a human-signed mandate, countersign a charge, verify the receipt offline, bind it to settlement, and watch a foreign payee denied.

The one claim

Pre-execution monetary spend authority under a human key the agent never holds, with receipts recomputable offline from public material. It stops an agent raising its own budget before the money moves, and lets a third party recompute the monetary receipt without trusting a mediator.

How it works

  • Mandate — a human-signed envelope; mandate_ref = sha256(JCS({cap, payer, period, revocation_state})) over a frozen, float-free RFC 8785 JCS form.
  • Guard — a pure evaluate() shared by enforcement and verification; checks authority binding → validity → payee → scope → per-charge cap → period cap → replay → human countersign bound to the exact intent. set_envelope refuses any envelope with a different human key or payer.
  • Receipts — guardrail_ref = sha256(JCS({agent_ref, mandate_ref, policy_bound_ref, verdict})); recomputable, not mediator-signed. DENY receipts embed the presented countersign.
  • Ledger — a single-writer hash chain with full-history rewrite and atomic os.replace; a failed commit is a final DENY, never an uncommitted ALLOW.

The red-team is negative-controlled

The adversary supplies creativity; the deterministic guard and an independent violation predicate supply the guarantee. The harness is itself proven to detect a bypass: tests/test_redteam_negative_control.py shows a deliberately fail-open guard is caught and the run FAILED, while the real guard DENIES the identical charge. A red-team that cannot detect a bypass is hollow; this one is proven to detect one. The default adversary is a live AI model (any OpenAI-compatible provider you configure); --adversary also accepts a human red-teamer, an authored attack file, or a seeded fuzzer. A model that refuses the adversary role is recorded as refused.

Honest limits

  • Ed25519 only in this public format. The commercial post-quantum engine is a separate product and is not reimplemented here.
  • The guard moves no funds; it is an enforcement + verification layer emitting canonical refs for a settlement rail.
  • The ledger is a single-writer chain, not distributed consensus.
  • The red-team guarantee rests on the deterministic guard + independent predicate, not the LLM.
  • No production adoption is claimed. This is a runnable reference, not a deployed service.
  • A zero-bypass result covers only the attacks actually run against the mandate shape exercised — not a proof of security.
  • Replay is exact-charge_id: an agent can mint id variants (whitespace, zero-width) to dodge replay, but every charge still counts against the period cap, so total spend stays bounded. The cap is the monetary backstop.
Full terms: DISCLAIMER.md. No warranty; Apache-2.0.

Conformance and composition

Zero AlgoVoi runtime dependencies (cryptography>=42 only). Agent Guard emits the keystone mandate step (order 2, canon_version: jcs-rfc8785-v1) and refs byte-identical to the published conformance vectors (28 vector tests), so it composes with algovoi-fabric by construction. It also bolts into algovoi-secure-hub as a spend-authority service via a thin wrapper exposing /health reflecting a live enforcement self-check. The suite is 256 tests: frozen-vector conformance, guard enforcement, red-team and countersign negative controls, per-adversary lane tests, and a fault-tolerance / error-correction suite. Each load-bearing property has an isolating mutation probe that fails a dedicated test when disabled.

Relationship to the estate

Agent Guard is the free, standalone entry point to the AlgoVoi spend-authority stack. It sits on the open JCS Canonicalisation Substrate and shares the guardrail_ref construction with Spend Guardrail (lite); the commercial Spend Guardrail adds post-quantum signing and the full Agent Passport + Payment Mandate enforcement stack.

Source