Skip to content

Python SDK

The Python SDK (agent-receipts) provides tools for creating, signing, and verifying Agent Receipts in Python applications.

Repository: agent-receipts/sdk-py

  • Create and sign Agent Receipts with Ed25519
  • Build and verify receipt chains
  • Validate receipts against the JSON Schema
  • Action taxonomy helpers and risk level utilities
  • Full type annotations (PEP 484)
from agent_receipts import (
CreateReceiptInput,
create_receipt,
generate_key_pair,
sign_receipt,
)
keys = generate_key_pair()
unsigned = create_receipt(
CreateReceiptInput(
issuer={"id": "did:agent:my-agent"},
principal={"id": "did:user:alice"},
action={
"type": "filesystem.file.read",
"risk_level": "low",
},
outcome={"status": "success"},
chain={
"sequence": 1,
"previous_receipt_hash": None,
"chain_id": "chain_session-1",
},
)
)
signed = sign_receipt(unsigned, keys.private_key, "did:agent:my-agent#key-1")

See Installation to get started.