Skip to main content

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

Project description

AgentOath Python SDK

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

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 an AgentOath Registry server:

from agentoath import TrustAgent
from agentoath.registry_client import RegistryClient

agent = TrustAgent.create(name="My Agent")
client = RegistryClient("https://registry.agentoath.ai")

# 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.

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

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

agentoath-0.2.0.tar.gz (46.0 kB view details)

Uploaded Source

Built Distribution

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

agentoath-0.2.0-py3-none-any.whl (35.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentoath-0.2.0.tar.gz
  • Upload date:
  • Size: 46.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for agentoath-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9c58397d0a7fafb5c8849dbd062dd3fb3744433c5ff5d419fb694bf10b7a3110
MD5 53d559e12e7ed5c833021f42135869dc
BLAKE2b-256 f815361945545d74c94468afd7c77ed6a7887468c09c9ef24e5470e830893fd8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: agentoath-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 35.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for agentoath-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 50bf2841a3421f4072f32c8bf4c3322358bd293c16736d8cc2ba94ad6fdd40dd
MD5 b3a8396d2d4e4545917b147596521a0f
BLAKE2b-256 7eb26333437908c08ace0bf697fcd1a6540ada7a9c5e765124ac00fd980318ce

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