Skip to main content

observer-protocol

Python SDK for Observer Protocol - agent identity, delegation, x402 verification, and chargeback prevention for the agentic economy.

Built on W3C DIDs and Verifiable Credentials. Type-hinted throughout.

Install

pip install observer-protocol

Quick Start

from observer_protocol import ObserverClient

client = ObserverClient()

# 1. Register an agent
pub, priv = ObserverClient.generate_keypair()
agent = client.register_agent(public_key=pub, agent_name="My Agent")

# 2. Verify key ownership
challenge = client.request_challenge(agent.agent_id)
sig = ObserverClient.sign_challenge(priv, challenge.nonce)
client.verify_agent(agent.agent_id, sig)

Delegation (Chargeback Prevention)

delegation = client.request_delegation(
    agent_id="d13cdfceaa8f895afe56dc902179d279",
    scope=["payments"],
    rails=["x402-usdc-base", "lightning", "tron:trc20"],
    spending_limits={"per_transaction": "100", "daily": "1000"},
    attestation_tier="enterprise",
)

delegations = client.list_delegations()
client.revoke_delegation(delegation.request_id)

Magic Link (Human-in-the-Loop)

magic_link = client.generate_magic_link(
    agent_id="d13cdfceaa8f895afe56dc902179d279",
    counterparty_did="did:web:neuralbridge.ai",
    counterparty_name="NeuralBridge",
    amount="50.00", currency="USDT", rail="usdt-trc20",
    purchase_description="GPU inference credits",
)
# Agent forwards magic_link.url to its human
result = client.get_magic_link_credential(magic_link.jti)

x402 Verification (USDC on Base)

result = client.verify_x402(
    agent_id="d13cdf...", agent_did="did:web:...",
    counterparty="did:web:hyperbolic.xyz",
    amount="100000", resource_uri="https://...",
    settlement_tx_hash="0x...", payment_payload={...},
)
print(result.verification.onchain_verified)  # True

Chain Verification

client.verify_lightning(receipt_reference="...", payment_hash="...", preimage="...")
client.verify_tron(receipt_reference="...", tron_tx_hash="...")

Trust Score

score = client.get_trust_score("d13cdf...")
print(score.trust_score, score.components.receipt_score)

ERC-8004 On-Chain Registry

summary = client.get_8004_summary("d13cdf...")
client.pin_registration(agent_id="...", agent_did="...", agent_name="Maxi")

Links

License

MIT

Metadata

Release files for observer-protocol 0.2.0

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

Built distribution (wheel)

Table of built distributions (wheels) for observer-protocol 0.2.0
File Interpreter ABI Platform
observer_protocol-0.2.0-py3-none-any.whl Python 3 none any Details

Release files / observer_protocol-0.2.0-py3-none-any.whl

Download URL observer_protocol-0.2.0-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc0a6a6163a554608bcba784028590e67d07e612b42fe33410eec646477e5854
BLAKE2b-256 checksum
How to use checksums
04151959c2d71d2c8bdb4655abcba4af0ce41e27260ccef73db5de350316a20c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.2.0 This release

1 release file

0.1.1

2 release files

0.1.0

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