Skip to main content

a2a-protocol-core

License: Apache 2.0

The open, deterministic protocol core of the DNS of Money agent-to-agent (A2A) payment surface — the dependency-light layer external AI agents adopt to resolve, hash, and initiate pay: payments.

The intelligence lives in the calling agent. This package serves deterministic, inspectable primitives — no rail selection, no scoring, no model anywhere in the money path.

Install

pip install a2a-protocol-core

Runtime deps are intentionally minimal: pydantic and requests.

What's in here

Module A2A ref Purpose
addressing FAS-1 pay: URI grammar + validation (is_valid_pay_uri)
semantic_normalizer A2A-009 collapse synonym verbs → canonical action codes
canonical_hash A2A-008 metadata- & vocabulary-stable payment-intent hash
schemas A2A-041 payment-hook request/response wire models
client A2A-041 A2APaymentHookClient over /v1/a2a/*

Quick start

from a2a_protocol_core import (
    A2APaymentHookClient,
    compute_canonical_hash,
    normalize_message,
)

# Your agent describes intent however it likes...
intent = {"action": "send", "amount": "2.50", "currency": "USD", "alias": "pay:agent.compute"}

# ...which collapses to a stable hash regardless of wording ("send" == "transfer" == "pay").
semantic_hash = compute_canonical_hash(normalize_message(intent))

client = A2APaymentHookClient(base_url="https://api.dnsofmoney.com")
result = client.trigger(
    job_id="job-001",
    provider_pay_address="pay:agent.compute",
    requester_pay_address="pay:vendor.alpha",
    amount="2.50",
    currency="USD",
    semantic_hash=semantic_hash,
)
print(result.settlement_result.status, result.iso_message_ref)

See examples/trigger_payment_hook.py.

Pay a pay: alias in one call (non-custodial)

Resolve the price, pay from your own wallet, and get back a signed resolve/verify/OFAC-screen attestation — one function, and your seed never leaves your process:

pip install "a2a-protocol-core[xrpl]"
from a2a_protocol_core import pay_alias_xrp

result = pay_alias_xrp(
    base_url="https://api.dnsofmoney.com",
    alias="pay:vendor.alpha",
    amount_xrp="0.10",
    seed="s...",             # YOUR XRPL wallet seed — signs locally, never transmitted
    api_key="fas_live_...",  # attributes the settle leg
)
print(result.tx_hash, result.summary.verdict)   # e.g. "A1B2…", "CLEAR"

Already settled the payment through your own wallet stack (or a Coinbase Agentic Wallet)? Skip the signing and just fetch the attestation — no [xrpl] extra:

from a2a_protocol_core import attest_settled_payment

result = attest_settled_payment(
    base_url="https://api.dnsofmoney.com",
    alias="pay:vendor.alpha",
    amount_xrp="0.10",
    tx_hash="A1B2C3...",     # your already-validated XRPL tx
    api_key="fas_live_...",
)

DNS of Money verifies an already-settled transaction and returns metadata — it never holds your keys or your funds.

Why canonical hashing?

Two agents describing the same payment with different words ("send" vs "transfer") or different session/trace metadata must produce the same intent fingerprint. compute_canonical_hash excludes non-semantic noise (session/request/trace ids, timestamps, idempotency keys, memos) and normalizes the action verb, so the hash captures what is being paid — not how it was phrased. That fingerprint binds an agent's intent to a settlement without trusting free text.

Design constraints

  • Deterministic only. Nothing here selects or scores a rail.
  • Off the money path. The hash and client describe and carry intent; the deterministic core (server-side) resolves, generates ISO 20022, and settles.
  • Dependency-light. Safe to embed in an agent runtime.

Development

pip install -e ".[dev]"
pytest
ruff check src tests

License

Apache-2.0 — permissive with an explicit patent grant. See LICENSE.

Download files

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

Source Distribution

a2a_protocol_core-0.2.1.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

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

a2a_protocol_core-0.2.1-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file a2a_protocol_core-0.2.1.tar.gz.

File metadata

  • Download URL: a2a_protocol_core-0.2.1.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for a2a_protocol_core-0.2.1.tar.gz
Algorithm Hash digest
SHA256 3f68065cd6e51cb5af2311d375ad4ee992c7eda723f788656b876dba1445f9fb
MD5 8c8d1240c6c06cee7c92e8be6e2aea06
BLAKE2b-256 8ee23072c32b1e0a90f10592d8406b2b48047b3f87a474a788a5729ad2b7b4f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for a2a_protocol_core-0.2.1.tar.gz:

Publisher: publish.yml on dnsofmoney/a2a-protocol-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file a2a_protocol_core-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for a2a_protocol_core-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 46fa0e745fd5d03c42e929733598d2bb5e20def60369ac758b83d6a173373b04
MD5 a7d75d88a8a8f274f10b52e8009e844c
BLAKE2b-256 6f890eb0cda68f355d3741a5ea6ffc474ebc609d225c19487a1acf889856a438

See more details on using hashes here.

Provenance

The following attestation bundles were made for a2a_protocol_core-0.2.1-py3-none-any.whl:

Publisher: publish.yml on dnsofmoney/a2a-protocol-core

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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