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.4.tar.gz (28.1 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.4-py3-none-any.whl (29.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xproof-0.2.4.tar.gz
  • Upload date:
  • Size: 28.1 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.4.tar.gz
Algorithm Hash digest
SHA256 167dd850227e0eb2ede50d3611d6088f464183d5b426647ac6f20db9abc3c7b9
MD5 bc0e5ed3644b0c04c716715216121704
BLAKE2b-256 326138f5bafda5df18319c753d18ecb3ec2b9dd40865fb5a238ffdb9070ba775

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xproof-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 29.9 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5cef20cd55fe1332dd3e79a1cf841e73bcab54675f446cb6a32253dbaa505b80
MD5 a168284918def52974897a8a3cb9b756
BLAKE2b-256 e24f281f39393f2508a582a251be0257976986ddb45825b1bce68c77913bd63b

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