Cryptographic proof that AI made a decision, with this reasoning, at this time
Project description
UATP Python SDK
Cryptographic proof that AI made a decision, with this reasoning, at this time.
Installation
pip install uatp
Or from source:
git clone https://github.com/KayronCalloway/uatp
cd uatp/sdk/python
pip install -e .
Quick Start
from uatp import UATP
client = UATP()
# Create proof
capsule = client.certify(
decision="Loan approved: $50,000 at 5.2% APR",
reasoning=[
{"step": 1, "thought": "Credit score 720 (excellent)"},
{"step": 2, "thought": "Debt-to-income 0.28 (acceptable)"}
]
)
# Verify proof
assert capsule.verify() == True
# Tamper detection
capsule.decision = "Loan approved: $500,000"
assert capsule.verify() == False # Signature invalid
What This Does
UATP creates independently verifiable proof that:
- A decision existed in this form
- At this specific time
- Tampering breaks verification
Features
| Feature | Status |
|---|---|
| Ed25519 signatures | Shipped |
| User-sovereign keys | Shipped |
| RFC 3161 timestamps | Beta |
| Standalone verification | Shipped |
API Reference
UATP(base_url="http://localhost:8000")
Initialize client.
client = UATP() # Local development
client = UATP(base_url="https://your-server.com") # Production
client.certify(decision, reasoning, task=None, confidence=None, metadata=None)
Create cryptographically signed capsule.
result = client.certify(
task="Approve loan",
decision="Approved for $50,000",
reasoning=[
{"step": 1, "thought": "Good credit", "confidence": 0.95}
],
confidence=0.87,
metadata={"model": "gpt-4"}
)
Returns: CertificationResult with capsule_id, proof_url, signature, timestamp
client.get_proof(capsule_id)
Retrieve full proof.
proof = client.get_proof("cap_abc123")
print(proof.decision)
print(proof.verify()) # True or False
client.list_capsules(limit=10)
List capsules.
capsules = client.list_capsules(limit=10)
for c in capsules:
print(f"{c.capsule_id}: {c.task}")
Local Signing (Recommended)
For maximum security, sign locally without sending content to server:
from uatp import UATP
client = UATP()
# Sign locally - private key never leaves your device
result = client.certify_local(
decision="Sensitive decision",
reasoning=[...],
passphrase="your-secure-passphrase"
)
# Only hash sent to server for timestamping
# Content stays local
Running the Backend
cd uatp
./scripts/dev/start_backend_dev.sh
# Server runs on http://localhost:8000
Integration Examples
With OpenAI
from openai import OpenAI
from uatp import UATP
openai = OpenAI()
uatp = UATP()
response = openai.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Should I invest in stocks?"}]
)
result = uatp.certify(
task="Investment advice",
decision=response.choices[0].message.content,
reasoning=[{"step": 1, "thought": "Analyzed request"}],
metadata={"model": "gpt-4"}
)
print(result.proof_url)
With Anthropic
from anthropic import Anthropic
from uatp import UATP
claude = Anthropic()
uatp = UATP()
message = claude.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=1024,
messages=[{"role": "user", "content": "Review this contract"}]
)
result = uatp.certify(
task="Contract review",
decision=message.content[0].text,
reasoning=[{"step": 1, "thought": "Analyzed contract"}]
)
Error Handling
try:
result = client.certify(...)
except ValueError as e:
print(f"Invalid parameters: {e}")
except ConnectionError as e:
print(f"Server unavailable: {e}")
Status
See STATUS.md for what's shipped vs beta vs experimental.
Support
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 uatp-0.2.1.tar.gz.
File metadata
- Download URL: uatp-0.2.1.tar.gz
- Upload date:
- Size: 19.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27ce2fc343a73893418d649fdca84543b30763a4c4566d3bdac48a91845b82bf
|
|
| MD5 |
e627cafb6c40f1eef8e511338d2e971d
|
|
| BLAKE2b-256 |
eb542fb3c3ba7f72d734d6a7c9bc63fba22b239d6229c5e59c4a0c61b5a89d68
|
File details
Details for the file uatp-0.2.1-py3-none-any.whl.
File metadata
- Download URL: uatp-0.2.1-py3-none-any.whl
- Upload date:
- Size: 20.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec44e985f5da6c40931a6f3a6d3935d6e157209f8c8d517d82d6b080fc5c1e1f
|
|
| MD5 |
395dc6a2a198ead0ab14e73de13f696e
|
|
| BLAKE2b-256 |
cf221a7520c88b808303f00cc20ee66818210686009e6c54a14e9ed9d436aef6
|