Skip to main content

Python reference implementation of the Agent Acknowledgment Protocol (AAP)

Project description

aap-ref-lib-py

PyPI License Spec

Python reference implementation of the Agent Acknowledgment Protocol (AAP) — typed acknowledgment events, the §7.2 reference weighting function, and a simple reputation derivation.

Install

pip install aap-manifest

What's in the box

Module Spec Purpose
entries §3, §4 AcknowledgmentEvent and its parts; the AckType vocabulary
weighting §7.2 compute_weight, type_weight, DEFAULT_TYPE_WEIGHTS
reputation §7.1 compute_reputation — derive a subject's score from events
store §9.3 / §9.4 InMemoryAcknowledgmentStore — dup-id rejection, withdrawal handling

Usage

from aap_manifest import (
    AcknowledgmentEvent, Issuer, Subject,
    compute_weight, InMemoryAcknowledgmentStore,
)

ev = AcknowledgmentEvent(
    id="urn:uuid:5f8a3c2e-…",
    type="ENDORSEMENT",
    issuer=Issuer(did="did:tutus:0xacme", key_id="did:tutus:0xacme#k"),
    subject=Subject(did="did:web:example.com:agents:code-reviewer"),
    signature=Signature(alg="EdDSA", value="…"),
    issued_at="2026-05-20T14:32:00Z",
)

result = compute_weight(ev, issuer_trust=0.8)   # value_weight applies only when verified

store = InMemoryAcknowledgmentStore()
store.append(ev)                                 # raises on duplicate id (§9.3)
rep = store.reputation("did:web:example.com:agents:code-reviewer")

Reference weight (spec §7.2)

weight = type_weight × issuer_trust × value_weight × witness_factor × time_decay
  • value_weight = 1 + log10(1 + usd_equivalent) applies only when the settlement reference is verified (§6.3); otherwise 1.
  • witness_factor = 1 + 0.25 × min(independent_witnesses, 4).
  • time_decay = exp(−Δt/τ), τ = 18 months; omit now for no decay.
  • A WITHDRAWAL zeroes the weight (positive-only vocabulary, §9.1).

This is the informative AAP reference. The normative aggregation — issuer-diversity penalty, recursive-trust bound, mandatory settlement verification — lives in AAR §9 and ships in the aar-manifest package.

How It Composes

aap-manifest   constructs and weights acknowledgment events  (this library)
aar-manifest   stores, chains, federates, and aggregates them
aap-validate   validates events against the schema + anti-abuse rules

Test

pip install -e ".[dev]"
pytest

License

Apache-2.0 — see LICENSE and NOTICE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aap_manifest-1.0.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aap_manifest-1.0.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file aap_manifest-1.0.0.tar.gz.

File metadata

  • Download URL: aap_manifest-1.0.0.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for aap_manifest-1.0.0.tar.gz
Algorithm Hash digest
SHA256 abb556e28a50f26488e44f7f63bd8124f827799e31a84b9b48abc8b42fdecb7d
MD5 bda278e0e96df7cdeb0a9e6423260833
BLAKE2b-256 967fa0750af497f2ccbfd6862f66b11c99dfcb81a7e4f88ae37286d41cc49df5

See more details on using hashes here.

File details

Details for the file aap_manifest-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: aap_manifest-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for aap_manifest-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0164052efa9c55608cf9db89d0bae5d68875471abcb96b13e9cc5c584a4c4c4b
MD5 b198fe108671519b008cb51c8943ea9b
BLAKE2b-256 935ff0185894bc1dad67529280540e2f6d9eb4aa867c66c50d5dbc30cb3bf034

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page