Skip to main content

Python SDK for xProof — blockchain-anchored proof-of-existence for AI agents on MultiversX

Project description

xproof

On-chain decision provenance for autonomous agents. WHY before acting. WHAT after. Timestamps written by the chain, not your agent.

pip install xproof

3 steps. 30 seconds.

Step 1 — Register (no wallet, no payment)

curl -X POST https://xproof.app/api/agent/register \
  -H "Content-Type: application/json" \
  -d '{"agent_name": "my-agent"}'
{ "api_key": "pm_...", "trial": { "remaining": 10 } }

Step 2 — Anchor WHY before acting

Hash your reasoning and certify it before your agent executes.

curl -X POST https://xproof.app/api/proof \
  -H "Authorization: Bearer pm_..." \
  -H "Content-Type: application/json" \
  -d '{
    "file_hash": "<sha256_of_reasoning>",
    "file_name": "reasoning.json",
    "author": "my-agent",
    "metadata": { "action_type": "decision" }
  }'
{ "id": "why-proof-uuid", "transaction_hash": "0x..." }

Step 3 — Anchor WHAT after acting

Hash your output and link it to the WHY proof.

curl -X POST https://xproof.app/api/proof \
  -H "Authorization: Bearer pm_..." \
  -H "Content-Type: application/json" \
  -d '{
    "file_hash": "<sha256_of_output>",
    "file_name": "output.json",
    "author": "my-agent",
    "metadata": { "action_type": "execution", "why_proof_id": "why-proof-uuid" }
  }'
{ "id": "what-proof-uuid", "transaction_hash": "0x..." }

When something goes wrong, you don't guess. You verify.


Python SDK

from xproof import XProofClient, hash_string

# Register — zero-friction, no wallet, no payment
client = XProofClient.register("my-agent")
# 10 free certs, API key stored automatically

# Step 2: Anchor WHY before acting
why = client.certify_hash(
    file_hash=hash_string('{"action": "summarize", "model": "gpt-4"}'),
    file_name="reasoning.json",
    author="my-agent",
    metadata={"action_type": "decision"},
)

# Step 3: Anchor WHAT after acting
what = client.certify_hash(
    file_hash=hash_string(execution_output),
    file_name="output.json",
    author="my-agent",
    metadata={"action_type": "execution", "why_proof_id": why.id},
)

print(what.transaction_url)  # MultiversX explorer link

Or use an existing API key:

client = XProofClient(api_key="pm_your_api_key")

Framework Integrations

LangChain

from xproof.integrations.langchain import XProofCallbackHandler

handler = XProofCallbackHandler(api_key="pm_...")
llm = ChatOpenAI(callbacks=[handler])

CrewAI

from xproof.integrations.crewai import XProofListener

listener = XProofListener(api_key="pm_...")

AutoGen

from xproof.integrations.autogen import XProofHook

hook = XProofHook(api_key="pm_...")
agent.register_hook("process_last_received_message", hook.on_message)

LlamaIndex

from xproof.integrations.llamaindex import XProofCallbackHandler
from llama_index.core import Settings
from llama_index.core.callbacks import CallbackManager

Settings.callback_manager = CallbackManager([XProofCallbackHandler(api_key="pm_...")])

4W Framework (WHO / WHAT / WHEN / WHY)

Full accountability metadata on every certification:

from xproof import XProofClient, hash_bytes

client = XProofClient(api_key="pm_your_key")

action_data = b'{"action": "generate_report", "model": "gpt-4"}'
action_hash = hash_bytes(action_data)

cert = client.certify_hash(
    file_hash=action_hash,
    file_name="agent-action.json",
    author="research-agent",
    who="erd1abc...or-agent-id",
    what=action_hash,
    when="2026-03-20T12:00:00Z",
    why=hash_bytes(b"Summarize Q1 earnings report"),
    metadata={"model": "gpt-4", "session_id": "sess-123"},
)

Batch Certification

Certify up to 50 files in a single API call:

results = client.batch_certify([
    {"file_hash": "abc123...", "file_name": "file1.pdf", "author": "my-agent"},
    {"file_hash": "def456...", "file_name": "file2.pdf"},
])

print(results.summary.total)    # 2
print(results.summary.created)  # 2

Certify a Local File

# Auto-hashes with SHA-256
cert = client.certify("path/to/report.pdf", author="my-agent")
print(cert.id)
print(cert.transaction_url)

Verify a Proof

# By proof ID
proof = client.verify("certification-uuid")
print(proof.file_name, proof.blockchain_status)

# By file hash
proof = client.verify_hash("e3b0c442...")

Pricing

pricing = client.get_pricing()
print(pricing.price_usd)  # e.g. 0.05

API Reference

XProofClient(api_key=None, base_url="https://xproof.app", timeout=30)

Parameter Type Default
api_key str None
base_url str "https://xproof.app"
timeout int 30 (seconds)

Methods

Method Description
XProofClient.register(agent_name) Register agent, get trial key
certify(path, author, file_name?, **fourW) Certify file (hashes locally)
certify_hash(file_hash, file_name, author, **fourW) Certify by pre-computed hash
batch_certify(files) Batch certify (up to 50)
verify(proof_id) Look up by proof ID
verify_hash(file_hash) Look up by file hash
get_pricing() Get current pricing

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

xproof-0.2.5.tar.gz (28.9 kB view details)

Uploaded Source

Built Distribution

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

xproof-0.2.5-py3-none-any.whl (30.7 kB view details)

Uploaded Python 3

File details

Details for the file xproof-0.2.5.tar.gz.

File metadata

  • Download URL: xproof-0.2.5.tar.gz
  • Upload date:
  • Size: 28.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for xproof-0.2.5.tar.gz
Algorithm Hash digest
SHA256 cde5e04d21e0a344a89150d0f7331d6ac4994f0b4381b8f6efdf54d115d3f5a5
MD5 7b50b18f7194834ebc2901e2760925ca
BLAKE2b-256 5b9129d6e0ddb23c5cc203ad79af0ac8ffa43b3894055e9b84ef001a33844e33

See more details on using hashes here.

File details

Details for the file xproof-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: xproof-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 30.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for xproof-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 aadc88637a90fdd6f1661980e8325ac4f9efaf90a15f36a5066a3a662ca18226
MD5 015446749f0cfdadae343f49b99e89b7
BLAKE2b-256 0590038da04270a1ccce6003fa7177a2d9064d97dee834c431ee71bc6bac65e6

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