Skip to main content

AgentTrust Python SDK

Trust infrastructure for AI agent transactions. Identity, contracts, escrow, reputation, disputes.

Install

pip install agentrust

Quick Start

from agentrust import AgentTrust

trust = AgentTrust(api_key="at_test_...", agent_id="your-agent-id")

# Verify a counterparty
peer = trust.identity.verify("seller-agent-id")
print(f"Score: {peer['reputation']['score']}")

# Create a contract
contract = trust.contracts.create(
    counterparty="seller-agent-id",
    terms={
        "items": [{"reference": "CARTON-XK200", "quantity": 10000, "unit_price_eur": 0.15, "total_eur": 1500}],
        "delivery": {"deadline_days": 5},
        "payment": {"total_eur": 1500, "method": "escrow", "currency": "EUR"},
        "penalties": {"late_delivery_pct_per_day": 2, "partial_delivery": "pro_rata_refund"},
    }
)

# Escrow payment
trust.payments.escrow(contract_id=contract["id"])

# Complete (releases funds + updates reputation)
trust.contracts.complete(contract["id"], received_quantity=10000)

9 Resources

trust.identity       # verify, register, list_agents, create_agent, suspend, reactivate
trust.contracts      # create, sign, get, complete, cancel, amend, list
trust.payments       # escrow, release, refund, get, list
trust.reputation     # get, history, compare
trust.disputes       # open, add_evidence, get, list
trust.analytics      # overview, benchmarks, leaderboard, discover, search, audit
trust.platform       # health, status, list_keys, create_key, data_export
trust.intelligence   # list_policies, create_policy, evaluate, list_alerts, graph, stream
trust.messaging      # send, inbox, conversations, list_scenarios, run_scenario

Error Handling

from agentrust import AgentTrust, AgentTrustApiError

try:
    trust.contracts.create(counterparty="bad-id", terms={})
except AgentTrustApiError as e:
    print(e.code)        # "not_found"
    print(e.status_code)  # 404
    print(e.request_id)   # "req_abc123"

Sandbox Scenarios

# Run a complete E2E scenario
result = trust.messaging.run_scenario("happy-path")
print(f"Status: {result['status']}, Duration: {result['total_duration_ms']}ms")

for step in result["steps"]:
    print(f"  {'✅' if step['status'] == 'ok' else '❌'} {step['step']} ({step['duration_ms']}ms)")

Available: happy-path, partial-delivery, non-delivery, negotiation, fraud-attempt, policy-cascade

Zero Dependencies

Uses only Python stdlib (urllib). No requests, no httpx. Works everywhere Python 3.10+ runs.

Links

Release files for agentrust-sdk 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentrust-sdk 0.1.0
File Size Uploaded
agentrust_sdk-0.1.0.tar.gz 12.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentrust-sdk 0.1.0
File Interpreter ABI Platform
agentrust_sdk-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.2 kB

Release files / agentrust_sdk-0.1.0.tar.gz

Download URL agentrust_sdk-0.1.0.tar.gz
Size 12.3 kB
Tags Source
SHA-256 checksum
How to use checksums
13a83d1bb8e177f85c9f62721b877c60049ff5cd33303c9acee576c760568c13
BLAKE2b-256 checksum
How to use checksums
87d990549105e3b565962f98df9bea5a4ce5d5e07b313eadfe93dc91997e89de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Release files / agentrust_sdk-0.1.0-py3-none-any.whl

Download URL agentrust_sdk-0.1.0-py3-none-any.whl
Size 13.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
de7657f4c8f95df1db58816e493591507e37eb6b7ec511c4dae45c26cc3cd763
BLAKE2b-256 checksum
How to use checksums
460b25b28cec658c09189041a9ae6753a63be893b0ee1f9b962e4fabcb01f36f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page