Skip to main content

NotaryOS SDK - Cryptographic receipts for AI agent actions. Issue, verify, and audit with Ed25519 signatures.

Project description

NotaryOS SDK for Python

Cryptographic receipts for AI agent actions. Issue, verify, and audit agent behavior with Ed25519 signatures.

Zero external dependencies. Uses only Python standard library (urllib, hashlib, json). Python 3.8+.

Install

pip install notaryos

Quick Start

Issue a Receipt (3 lines)

from notaryos import NotaryClient

notary = NotaryClient(api_key="notary_live_xxx")
receipt = notary.issue("data_processing", {"key": "value"})
print(receipt.verify_url)  # https://api.agenttownsquare.com/v1/notary/r/abc123

Verify a Receipt (no API key needed)

from notaryos import verify_receipt

is_valid = verify_receipt(receipt_dict)
# True

Full Example

from notaryos import NotaryClient

notary = NotaryClient(api_key="notary_live_xxx")

# Issue a receipt for an agent action
receipt = notary.issue("financial.transfer", {
    "from": "billing-agent",
    "to": "ledger-agent",
    "amount": 150.00,
    "currency": "USD",
})
print(f"Receipt: {receipt.receipt_id}")
print(f"Verify:  {receipt.verify_url}")

# Verify it
result = notary.verify(receipt)
print(f"Valid: {result.valid}")          # True
print(f"Signature: {result.signature_ok}")  # True

# Check service health
status = notary.status()
print(f"Service: {status.status}")  # "active"

# Get public key for offline verification
key_info = notary.public_key()
print(key_info["public_key_pem"])

# Look up a receipt by hash (public, no API key)
result = notary.lookup("abc123def456...")

API Reference

NotaryClient(api_key, base_url=None, timeout=30, max_retries=2)

Method Auth Description
issue(action_type, payload, ...) API Key Issue a signed receipt
verify(receipt) API Key Verify a receipt
verify_by_id(receipt_id) API Key Verify by receipt ID
status() API Key Service health check
public_key() API Key Get Ed25519 public key
lookup(receipt_hash) Public Look up receipt by hash
me() API Key Authenticated agent info

verify_receipt(receipt_dict, base_url=None) -> bool

Public verification without API key.

CLI

# Check service status
notaryos status

# Issue a receipt
notaryos issue notary_live_xxx my_action

# Verify a receipt
notaryos verify '{"receipt_id": "...", ...}'

# Look up by hash
notaryos lookup abc123def456

Error Handling

from notaryos import NotaryClient, AuthenticationError, RateLimitError, ValidationError

try:
    receipt = notary.issue("action", payload)
except AuthenticationError:
    # Invalid API key
    pass
except RateLimitError as e:
    # Wait e.retry_after seconds
    pass
except ValidationError:
    # Check error details
    pass

Context Manager

with NotaryClient(api_key="notary_live_xxx") as notary:
    receipt = notary.issue("action", {"key": "value"})
# Connection automatically closed

Get an API Key

  1. Sign up at agenttownsquare.com/notary
  2. Generate an API key from the dashboard
  3. Keys start with notary_live_ (production) or notary_test_ (sandbox)

Links

License

MIT

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

notaryos-2.1.1.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

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

notaryos-2.1.1-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file notaryos-2.1.1.tar.gz.

File metadata

  • Download URL: notaryos-2.1.1.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for notaryos-2.1.1.tar.gz
Algorithm Hash digest
SHA256 9687f5112527f8f43f96500b0035c4d3b363832d782a8f35f8b60ee802de0830
MD5 43f7a78f84bf9453370ac6c45391d323
BLAKE2b-256 f12a9192b32f55489c0a4a0af78de1b75de33bec02f197f6828a0cfacb4bb7f6

See more details on using hashes here.

File details

Details for the file notaryos-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: notaryos-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for notaryos-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 edfac9a5f8c3548018d8a8415e2264b897d8c693deb74055db8b8e724518f0d3
MD5 1ed9b18b8c09598f67e311e6a17320f3
BLAKE2b-256 c909e6de38713b11cd7cc6244e7feb4d99b25adf6b7e5ed22da71d2b2ae2bb3d

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