aar-ref-lib-py
Python reference implementation of the Agent Acknowledgment Record
(AAR) — the append-only, hash-chained ledger that
stores and aggregates AAP acknowledgment events, with Merkle checkpoints and the
normative §9 default reputation algorithm.
Install
pip install aar-manifest
What's in the box
| Module | Spec | Purpose |
|---|---|---|
entries |
§3, §5, §8 | RecordEntry, Checkpoint, ReputationResult |
ledger |
§3, §4 | canonicalize, compute_entry_hash, compute_commitment, build_genesis, append_event, verify_chain |
checkpoint |
§5 | merkle_root, build_inclusion_proof, verify_inclusion_proof, build_checkpoint |
aggregation |
§9 | aggregate_reputation — the normative default algorithm |
store |
§3/§4/§8 | InMemoryLedger — accept, withdraw, query, verify, reputation |
Usage
from aar_manifest import InMemoryLedger
ledger = InMemoryLedger("did:tutus:0xagg")
ev = {
"id": "urn:uuid:…",
"type": "ENDORSEMENT",
"issued_at": "2026-05-20T14:32:00Z",
"issuer": {"did": "did:web:alice"},
"subject": {"did": "did:web:bob"},
}
ledger.accept(ev) # chained Record Entry; raises on duplicate id (§4.1.2)
valid, errors = ledger.verify(recompute_hashes=True)
rep = ledger.reputation("did:web:bob", settlement_verified=lambda e: False)
The wrapped event is a plain dict (snake_case keys, as on the wire) so the
package takes no hard dependency on aap-manifest.
The default aggregation (spec §9)
weight(a) = type_weight × issuer_trust × value_weight × witness_factor
× time_decay × (0 if withdrawn else 1) × settlement_factor
value_weight = 1 + log10(1 + usd)applies only when settlement is verified (§6.3).settlement_factor = 0.5when a value is claimed but unverified (T2/T10), else 1.- The issuer-diversity penalty (§9.5) scales the aggregate by
diversity / 0.3when Simpson diversity over distinct issuers/controllers is below 0.3. - Recursive issuer trust is bounded at depth 2 with an attestation fallback (§9.4); pass
issuer_trust=orattestation=to drive it.
aggregate_reputation returns the full ReputationResult (the AAR §8
ReputationSource shape ADP consumes).
Hash chaining & checkpoints
compute_entry_hash hashes the immutable content (everything except
entry_hash and the mutable status fields withdrawn / withdrawal_ref), so a
withdrawal can flip those fields without breaking chain continuity (§3.2, §4.2,
§7.4). build_checkpoint produces a signed, prev-chained Merkle commitment;
build_inclusion_proof / verify_inclusion_proof give single-entry inclusion
proofs (§5.4).
How It Composes
aap-manifest constructs and weights acknowledgment events
aar-manifest stores, chains, federates, and aggregates them (this library)
aar-validate audits a ledger's chain, sequencing, and replay
Test
pip install -e ".[dev]"
pytest
License
Metadata
Release files for aar-manifest 1.0.0
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 | Actions |
|---|---|---|---|---|
| aar_manifest-1.0.0.tar.gz | 17.2 kB | Without provenance | Details for aar_manifest-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aar_manifest-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for aar_manifest-1.0.0-py3-none-any.whl |
Total release size: 34.2 kB
Release files / aar_manifest-1.0.0.tar.gz
| Download URL | aar_manifest-1.0.0.tar.gz |
|---|---|
| Size | 17.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
570fbbfdded015a0e1dfadb1e3a11f9a91461b99b675813c4d31b33556c99602
|
|
BLAKE2b-256 checksum How to use checksums |
a1d87732b42c952d154b6ea4bb33301e4d2742f60c6858d641820e6578318fc7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.3
|
Release files / aar_manifest-1.0.0-py3-none-any.whl
| Download URL | aar_manifest-1.0.0-py3-none-any.whl |
|---|---|
| Size | 17.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a284834d940ad98cbe8d895fa58c44b1557799178df9e0b96bc05087c2e4c2aa
|
|
BLAKE2b-256 checksum How to use checksums |
43351dac712d89ffe7d568fa202ed98c77dde4cdff4f137f71ea04069330f0ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.3
|
Security for aar-manifest 1.0.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.