Skip to main content

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

# Clone and install locally
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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uatp-0.2.0.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

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

uatp-0.2.0-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file uatp-0.2.0.tar.gz.

File metadata

  • Download URL: uatp-0.2.0.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

Hashes for uatp-0.2.0.tar.gz
Algorithm Hash digest
SHA256 4f6a0c8226d1b89bc9067e58e02d94d625ec63b8311403b5a15e7230f22dcd2d
MD5 d245db95c400baf2ebe73e2bde4b6a69
BLAKE2b-256 54c23147ac018b1800936c3f120543b4e8bf981d44fa5c65a0b2ff514322d150

See more details on using hashes here.

File details

Details for the file uatp-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: uatp-0.2.0-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

Hashes for uatp-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c9b87786e931312d9b86b16343d4b792557dc3395910286089e87f1276658f2
MD5 47471af838eb700bd9a4308c3c92a1c6
BLAKE2b-256 0789351f18d1e91b6c652c113b78b77bb90e1f91ac06c9ff257b29196dbebc49

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