Skip to main content

AgentOath Python SDK

The open protocol for AI agent identity, trust, and notarization.

Two layers, one package

Peer-to-peer (everything below unless marked otherwise) — identities are did:trust:agent:, receipts live with whoever holds them, and trust is a score you compute from the receipts you have received. Nothing central to trust or pay for. Run your own registry with pip install agentoath-registry if you want one.

Hosted Registry (agentoath.hosted) — a client for registry.agentoath.com, a notarisation service where you publish signed receipts about your own actions and any third party can verify them without trusting the platform. Identities are did:agentoath: and the wire format is different.

They are separate protocols. A receipt built for one is rejected by the other, by design. The same Ed25519 keypair can hold an identity in both.

Stability

The peer-to-peer layer has been in use since 0.2 and follows semantic versioning from 1.0 on: no breaking change without a major bump.

agentoath.hosted is provisional. The wire format it speaks is fixed — it is pinned to the Registry's published spec at GET /api/v1/registry, and the cross-language canonical fixtures in tests/ fail if either side drifts. What may still move is the shape of this client: argument names, helper functions, where things live. That is a deliberate exception to the guarantee above, stated here rather than implied by the version number, because the module is new and has had one real integration so far.

If you need it frozen, pin an exact version. If you build on it, the stable thing to build on is the wire format, not this client's signatures.

Installation

pip install agentoath

Quick Start

from agentoath import TrustAgent, TrustReceipt

# Create a new Agent identity
agent = TrustAgent.create(
    name="My AI Assistant",
    capabilities=["chat", "search"],
    platform="custom",
)

# Save identity to disk
agent.save("my_agent.json")

# Load identity from disk
agent = TrustAgent.load("my_agent.json")

# Sign a trust receipt after an interaction
receipt = agent.sign_receipt(
    to_agent="did:trust:agent:bbb...",
    action="collaboration",
    rating=9,
    description="Built a great report",
)

# Verify a receipt
is_valid = receipt.verify_from_signature(other_agent.public_key)

# Calculate trust score
score = agent.calculate_trust_score(receipts)
print(f"Trust Score: {score.overall}")

CLI

The SDK includes a command-line tool:

# Generate a new Agent keypair
agentoath init --name "My Agent" --capabilities "chat,search"

# Display Agent info
agentoath info

# Sign a receipt
agentoath sign-receipt --to did:trust:agent:bbb... --rating 9

# Verify a receipt
agentoath verify-receipt receipt.json --from-key-file agent_key.json

# Compute trust score
agentoath trust-score --receipts receipts.json --target-did did:trust:agent:bbb...

Registry Client

Connect to a registry you run yourself (pip install agentoath-registry). For the hosted Registry at registry.agentoath.com see Hosted Registry below — it is a different protocol and this client cannot talk to it.

from agentoath import TrustAgent
from agentoath.registry_client import RegistryClient

agent = TrustAgent.create(name="My Agent")
client = RegistryClient("http://localhost:8500")  # your own server

# Register with the Registry
resp = client.register(agent)
print(resp.data["identity_certificate"])

# Publish a receipt
receipt = agent.sign_receipt(to_agent="did:trust:agent:bbb...", rating=9)
client.publish_receipt(receipt)

# Query trust score
score = client.query_trust_score("did:trust:agent:bbb...")
print(score.data)

The client supports offline mode -- when the Registry is unreachable, it returns graceful fallback responses instead of crashing.

Hosted Registry

A client for registry.agentoath.com. Disabled by default — it sends nothing until you turn it on.

from agentoath.hosted import (
    AgentOathIdentity, AgentOathClientConfig, AgentOathRegistryClient,
    build_signed_receipt, verify_receipt_locally, sha256_json,
)

identity = AgentOathIdentity.generate()
print(identity.did)          # did:agentoath:<sha256 of the raw public key>
print(identity.private_key)  # keep this out of version control

client = AgentOathRegistryClient(AgentOathClientConfig(
    base_url="https://registry.agentoath.com",
    api_key="...",
    enabled=True,
))
client.register_identity(identity, name="my-service")

receipt = build_signed_receipt(
    identity,
    receipt_id="verdict-1234",
    action="compliance.verdict.red",
    metadata={"schema": "v1", "content_digest": sha256_json(text)},
)
client.publish_receipt(receipt)

Three rules the Registry enforces. build_signed_receipt checks all three locally, so you get a Python exception at the call site instead of an HTTP 422 somewhere else:

  1. rating must be a JSON integer 0–10. Python prints 7.0 where JavaScript prints 7, so a float makes the signature unverifiable.
  2. Empty optional fields must be omitted entirely, never sent as "".
  3. metadata must always be present, and filled in before signing.

Receipts are public and permanent, so metadata keys are checked against a 28-key blocklist — matched per underscore-separated segment, which means prompt_hash and user_email are rejected. Use content_digest, actor_ref and similar instead. Full guide: https://agentoath.com/integrate.

API Reference

TrustAgent

Method Description
TrustAgent.create(name, capabilities, platform) Create a new Agent with a fresh keypair
TrustAgent.load(path, password) Load an Agent from a key file
agent.save(path, password) Save the Agent's identity to disk
agent.sign_receipt(to_agent, action, rating) Sign a Trust Receipt
agent.counter_sign_receipt(receipt) Add a counter-signature
agent.verify_receipt(receipt, from_public_key) Verify a receipt's signature
agent.calculate_trust_score(receipts) Compute trust score
agent.did The Agent's DID
agent.public_key_formatted Public key as ed25519:{base64}

TrustReceipt

Method Description
TrustReceipt.create(from_agent_did, from_private_key, to_agent_did) Create and sign a receipt
TrustReceipt.from_dict(data) Create from a dictionary
receipt.counter_sign(to_private_key) Add counter-signature
receipt.verify_from_signature(public_key) Verify initiator's signature
receipt.verify_counter_signature(public_key) Verify counter-signature
TrustReceipt.verify(receipt_dict, from_public_key) Static verification

RegistryClient

Method Description
client.register(agent) Register an Agent
client.get_agent(did) Look up an Agent by DID
client.get_agent_card(did) Get Agent's public profile
client.search_agents(name, platform, capability) Search for Agents
client.publish_receipt(receipt) Publish a signed receipt
client.get_receipts(agent_did) Get receipts for an Agent
client.verify_receipt(receipt, from_public_key) Online verification
client.query_trust_score(agent_did) Query trust score

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run with coverage
pytest --cov=agentoath --cov-report=term-missing

Links

License

Apache 2.0

Download files

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

Source Distribution

agentoath-1.0.0.tar.gz (69.9 kB view details)

Uploaded Source

Built Distribution

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

agentoath-1.0.0-py3-none-any.whl (47.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentoath-1.0.0.tar.gz
  • Upload date:
  • Size: 69.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for agentoath-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6fe4e6b06192e5815ee088e348e1facb63e3bfa83c8b29aea9369a32c078e032
MD5 f873ea6c0761c1d1608ee461c159ec2a
BLAKE2b-256 d10bfe953c8e94c08f1a5523565db82e37efc3a280002c28685b4692954d72c8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agentoath-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 47.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.4

File hashes

Hashes for agentoath-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ce2e0356bf9b46615dc25534550b8fdcd03b4c33693cec61cae4ff342fc36389
MD5 f8e17a73a8af085d79ff9c95c4bad82b
BLAKE2b-256 3d6b6a626c58e7b30767deec605e57487eae2c10431e1d912f020d31907b3e58

See more details on using hashes here.

Release history Release notifications | RSS feed

2.0.0

2 files

1.1.0

2 files

This release

1.0.0 This release

2 files

0.2.0

2 files

0.0.1

2 files

Supported by

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