Sign tamper-evident receipts for AI agent actions. Byte-identical canonicalization with the Aisley server, CLI, and verifier.
Project description
aisley
Sign tamper-evident receipts for AI agent actions. Each receipt records a specific model call, tool call, policy decision, and approval state as signed, hash-only evidence (no raw prompts, model outputs, or tool arguments are stored). Anyone can later verify a receipt — schema, canonical hash, Ed25519 signature, key trust, and timestamp — with no Aisley account.
The SDK's canonicalization is byte-identical to the Aisley server, CLI,
verifier, and the TypeScript aisley package, so a receipt re-derives the same
hash anywhere, in any language.
Aisley records the policy decision your system made as evidence. It does not run a policy engine and does not decide whether an action is allowed or block execution — your application makes and enforces those decisions.
Install
pip install aisley
Requires Python ≥ 3.10. Pure standard library — no third-party dependencies. Typed
(py.typed).
Quick start
import os
from aisley import AisleySdk, create_http_receipt_creator
aisley = AisleySdk(
agent={"name": "RefundAgent", "version": "v1.0.0"},
model={"provider": "OpenAI", "name": "gpt-4.1", "version": "2026-06-01"},
receipt_creator=create_http_receipt_creator(
endpoint="https://app.aisley.example/api/receipts",
organization_id="org_123",
api_key=os.environ["AISLEY_RECEIPT_API_KEY"],
),
)
# 1. Wrap the model call — captures hash-only evidence of the prompt/input/output.
model_call = aisley.call_model(
prompt={"system_prompt": system_prompt, "template_version": "refund-agent-v3"},
input=customer_request,
call=lambda input: call_model_provider(input),
)
# 2. Wrap the tool call — builds, signs, submits, and returns the receipt.
tool_call = aisley.call_tool(
model_call=model_call,
tool={"name": "stripe.refunds.create", "version": "2026-05-18"},
action_name="refund.create",
args=refund_args,
risk_level="high",
call=lambda args: stripe_refunds_create(**args),
)
print(tool_call.receipt["receipt_id"]) # the signed receipt id
print(tool_call.output) # your tool's real return value
Open the receipt in the dashboard, or paste it into the /verify page to confirm
it independently.
Fail-open by default
Receipt submission is decoupled from your action. If recording a receipt fails
(outage, 5xx, timeout), the SDK still runs your real business action and returns a
result with receipt=None and receipt_error set — the audit logger can never
take down your production path. Pass on_receipt_error="fail-closed" to gate
execution on a durable receipt instead.
Key exports
| Export | Purpose |
|---|---|
AisleySdk / create_aisley_sdk |
Wrap model and tool calls; build, sign, and submit receipts. |
create_http_receipt_creator |
Submit receipts to an Aisley server over HTTP (deterministic idempotency key, timeout). |
build_receipt_input |
Build a receipt input without executing a call. |
create_evidence_hash |
The canonical, cross-language evidence hash. |
canonicalize_json |
The canonical JSON form used for hashing and signing. |
AisleyReceiptApiError / AisleyReceiptTimeoutError / AisleyReceiptTransportError |
Typed errors. |
License
MIT — see LICENSE.
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 aisley-0.1.0.tar.gz.
File metadata
- Download URL: aisley-0.1.0.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a4633bee478324e00c9c5c64f03f18d98746d874f2b2f5461e9771b1c8c8476
|
|
| MD5 |
f3a6debfeb7dcd0b6cbbb1bea4e6ddae
|
|
| BLAKE2b-256 |
a642507516cdd30acdbf0dfcdb9d4dad12bba2f0c94017fd103de771d8571e17
|
File details
Details for the file aisley-0.1.0-py3-none-any.whl.
File metadata
- Download URL: aisley-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49b61ae11dea5929bb85ea91e78f0b8d06fe65e3ec804d3adda08aa7b5277207
|
|
| MD5 |
6ad74214be3eb95cf6b312b15e0ccd26
|
|
| BLAKE2b-256 |
1a3d1da423f01bc55eec3fb0df302362ed7502413317ed575ce52534a7088ee0
|