Python SDK for ZeroHal — decision verification for AI agents
Project description
ZeroHal Python SDK
The official Python SDK for ZeroHal — the decision verification layer for AI agents.
Your AI agent decides. ZeroHal certifies.
Installation
pip install zerohal-sdk
Quick Start
from zerohal_sdk import ZeroHalClient
client = ZeroHalClient(api_key="zh_live_your_api_key")
# Submit evidence (purchase order, invoice, receipt)
po = client.create_evidence("sap", "purchase_order", {
"po_number": "PO-2026-001",
"supplier": "Acme Corp",
"total_amount": 15000.00,
"currency": "USD",
"line_items": [{"item": "Widget A", "quantity": 100, "unit_price": 150.00}],
})
invoice = client.create_evidence("email", "invoice", {
"invoice_number": "INV-5001",
"po_reference": "PO-2026-001",
"supplier": "Acme Corp",
"total_amount": 14850.00,
"currency": "USD",
"line_items": [{"item": "Widget A", "quantity": 100, "unit_price": 148.50}],
})
receipt = client.create_evidence("warehouse", "receipt", {
"receipt_number": "REC-8001",
"po_reference": "PO-2026-001",
"supplier": "Acme Corp",
"line_items": [{"item": "Widget A", "quantity_received": 100}],
})
# Verify the invoice with a three-way match
decision = client.three_way_match(invoice_evidence_id=invoice["evidence_id"])
print(decision["conclusion"]) # "approved"
print(decision["proof_object"]) # Full proof object with observations, rules, constraints
Claims Adjudication
# Verify a healthcare claim in one step
decision = client.verify_claim({
"claim_id": "CLM-2026-001",
"patient_id": "PT-1234",
"provider_npi": "1234567890",
"date_of_service": "2026-03-15",
"diagnosis_codes": ["J06.9"],
"procedures": [
{"cpt_code": "99213", "units": 1, "billed_amount": 150.00},
],
"place_of_service": "11",
"claim_type": "practitioner",
})
print(decision["conclusion"]) # "approved" or "rejected"
Domain Accelerator Templates
# List available templates
templates = client.list_templates()
for t in templates["templates"]:
print(f"{t['template_id']}: {t['name']} ({t['vertical']})")
# Activate a template for your tenant
activation = client.activate_template("claims_adjudication", config={
"amount_tolerance_pct": 5.0,
})
Decision Replay
# Replay a decision to verify deterministic output
replay = client.replay_decision(decision["decision_id"])
print(replay["match"]) # True — same inputs, same outputs
print(replay["differences"]) # [] — no differences
API Reference
ZeroHalClient(api_key, base_url="https://api.zerohal.ai", timeout=30)
Create a client instance.
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key |
str |
required | Your ZeroHal API key (starts with zh_live_ or zh_test_) |
base_url |
str |
"https://api.zerohal.ai" |
API base URL |
timeout |
int |
30 |
Request timeout in seconds |
Evidence
create_evidence(source_system, evidence_type, payload, source_id=None)— Create an evidence recordget_evidence(evidence_id)— Retrieve an evidence record by ID
Decisions
three_way_match(invoice_evidence_id=None, invoice_number=None)— Trigger a three-way invoice matchverify_claim(claim_data)— Submit and adjudicate a healthcare claimget_decision(decision_id)— Retrieve a decision by IDreplay_decision(decision_id)— Replay a decision for deterministic verificationanalyze_and_route(invoice_evidence_id)— Full AP pipeline: match + discrepancies + routinglist_decisions(limit=50, offset=0, workflow_type=None, conclusion=None)— List decisions
Templates
list_templates()— List available Domain Accelerator Templatesget_template(template_id)— Get template detailsactivate_template(template_id, config=None)— Activate a template
Other
analyze_discrepancies(invoice_evidence_id)— Analyze invoice discrepanciesroute_exceptions(invoice_evidence_id)— Route discrepancies to handler queuesget_usage(period_start=None, period_end=None)— Get usage summaryhealth()— Check API health
Error Handling
from zerohal_sdk import ZeroHalClient, ZeroHalError
client = ZeroHalClient(api_key="zh_live_...")
try:
decision = client.three_way_match(invoice_evidence_id="invalid-id")
except ZeroHalError as e:
print(e.status_code) # 400
print(e.detail) # "Invalid UUID format for evidence_id"
print(e.request_id) # Request ID for support
License
Apache License 2.0
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
zerohal_sdk-0.1.0.tar.gz
(5.5 kB
view details)
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 zerohal_sdk-0.1.0.tar.gz.
File metadata
- Download URL: zerohal_sdk-0.1.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb52537a01d082ef81f64773cb2f05006fab3f4e74bfa3273bafe807a2989f69
|
|
| MD5 |
7e9a7af6f385ec6f0868c6fdc44a53c8
|
|
| BLAKE2b-256 |
0e0d8801cfe524de16c6eda154949aa68e8f67628653ab97871e7f7b73f7f490
|
File details
Details for the file zerohal_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: zerohal_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f417a4a58f4aa8bb3ac22618131a229a930433e5f513c72edadf708a8c2bcec
|
|
| MD5 |
f9f3fc93e0609e0b9167d4f7e753dd13
|
|
| BLAKE2b-256 |
d565a8e9dcd8a8099682e402573ebe8af80eb8e265c41f52366db5a08f16cffe
|