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
- xproof.app — dashboard & docs
- npm SDK —
npm install @xproof/xproof - Examples — LangChain, CrewAI, AutoGen, LlamaIndex
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xproof-0.2.6.tar.gz.
File metadata
- Download URL: xproof-0.2.6.tar.gz
- Upload date:
- Size: 29.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56ae8c601db925dc4f1e0a378945eaa837c699dce4d00581041818272957f136
|
|
| MD5 |
b8a9931069d8aa0ee05922560cab45e3
|
|
| BLAKE2b-256 |
e0fedf3953939ff1777efe492fd7ea45289df1b2b40a3b97f99705a357a6de56
|
File details
Details for the file xproof-0.2.6-py3-none-any.whl.
File metadata
- Download URL: xproof-0.2.6-py3-none-any.whl
- Upload date:
- Size: 31.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aec34cb0cb7d104db0a7fc0b11c2f00acd680d4b7f1ba8d8ab42d5cd740503f8
|
|
| MD5 |
371271309cddad14b9f8b07086685874
|
|
| BLAKE2b-256 |
53eca4625a142884b2dd3c5f623b7795ba23958962f1e4d80217d3ae71d74667
|