The Mandate Format (MMF): bounded, verifiable spending authority for agent-initiated payments. By Shedrack Chiedozie Aji / Doztra Ltd
The mandate toolkit for agent-initiated payments.
Built and maintained by Shedrack Chiedozie Aji at Doztra Ltd. Mandata specifies and implements the Mandate Format (MMF), an open format for bounded spending authority in agentic payment systems.
When AI agents hold spending authority, someone must answer: what exactly are they allowed to do — and can you prove it afterward? Mandata is a reference implementation of the bounded-autonomy mandate chain:
principal → agent → credential → transaction → evidence
Agentic payment protocols (AP2, x402, card-network agent programs) let AI agents initiate real financial transactions. But production systems lack a standard way to:
Mandata formalizes all four as a small, dependency-light library.
pip install mandata
from mandata import Mandate, Bounds, enforce, claim, settle, to_minor
# A principal grants a bounded mandate to an agent (amounts in minor units)
mandate = Mandate(
principal="user:alice",
agent="agent:shopping-bot",
bounds=Bounds(
max_amount=to_minor("500.00", "GBP"), # 50000 pence per transaction
currency="GBP",
allowed_payees=["store.example"],
expires_in_days=30,
velocity_limit=3, # max authorizations per day
),
)
# At transaction time: deterministic enforcement BEFORE settlement.
# tx_id makes retries idempotent and links the authorization to settlement.
decision = enforce(mandate, payee="store.example", amount=4999, currency="GBP", tx_id="order-1")
assert decision.allowed # → True (status AUTHORIZED, amount reserved)
print(decision.check) # → "WITHIN" (normative MMF check ID)
# Claim takes the single dispatch slot and verifies the rail instruction binds
# to the approval — only then submit, and only once.
claim(mandate, "order-1", "store.example", 4999, "GBP")
... # rail.pay(..., idempotency_key="order-1")
settle(mandate, "order-1") # or void(mandate, "order-1") if it failed
principal issues mandate ──► credential binds mandate to agent
│ │
▼ ▼
agent proposes transaction ──► mandate gate (enforce())
│ │
▼ ▼
allowed? ──► yes: execute no: reject
│ │
└───────► evidence record appended (hash-chained audit log)
See docs/architecture.md for the full model, docs/mandate-model.md for the schema, and docs/diagrams.md for the system design diagrams.
tx_id idempotency, authorize/settle/void lifecycle, payee binding in adapters, gate-signed evidence, cross-process serializable SQLite store, 58 conformance vectorsINVALID_CHAIN for unresolvable/cyclic chains, chain-wide credential verification, claim()/unclaim() single-dispatch lifecycle (AUTHORIZED→CLAIMED→SETTLED), atomic durable evidence in the state transaction, byte-level canonical serialization, 64 conformance vectorsREJECTED evidence for failed lifecycle transitions, velocity counts issued authorizations (void refunds budget only), budget-window attenuation, canonical evidence v2 (currency + status hashed, NFC), 65 conformance vectorsvoid of a CLAIMED transaction requires confirmed_rail_cancelled (uncertain in-flight stays CLAIMED), serialized ledger-first ordering + TX_CONFLICT evidence-only rule, mediation-scoped claim guarantee, REJECTED records carry the attempted instruction, byte-level timestamp rule, per-gate evidence chain scope — 66 vectorsREFERENCE provenance; void of a CLAIMED transaction requires a cancellation reference; checked arithmetic on accumulated totalsclaim (a revoked mandate's unclaimed authorization cannot be dispatched); per-state revocation policy; principal-authorized delegation modev0.5 candidate: optional clamp-to-owner-cap semantics for delegate spend
https://github.com/mandataformat/mandata/issues/33
Labels: 없음
[feat] Property-based tests for enforce() with hypothesis
https://github.com/mandataformat/mandata/issues/24
Labels: enhancement, good first issue
[docs] 10-minute quickstart tutorial
https://github.com/mandataformat/mandata/issues/22
Labels: documentation, good first issue
Welcome to Mandata — start here
https://github.com/mandataformat/mandata/issues/1
Labels: documentation, good first issue
Thanks for your interest in contributing. Mandata is young — the best way in is a
good first issue, or the roadmap item that matches your skills.
git clone https://github.com/mandataformat/mandata.git
cd mandata
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest
feat:, fix:, docs:, test:, refactor:, chore:mainruff check . && ruff format . before pushingParticipation means agreeing to the Code of Conduct.
Open a discussion or an issue — no question is too basic.