LedgerProof callback handler for LlamaIndex — Article 50 transparency receipts for RAG and agent workflows.
Project description
ledgerproof-llamaindex
LedgerProof callback handler for LlamaIndex. Emits cryptographically signed, Bitcoin-anchorable EU AI Act Article 50 transparency receipts for RAG queries, chat sessions, and agent workflows — without modifying your LlamaIndex response payload.
Status: v0.1.0 — MVP. APIs may change before v1.0.
What this is
LedgerProof is an open cryptographic protocol that:
- Emits a signed receipt for every AI-touched interaction.
- Batches receipts into a Merkle tree.
- Anchors the tree root to Bitcoin via OP_RETURN.
- Verifies offline from Bitcoin chain + protocol public key + receipt alone.
This package wires LedgerProof into LlamaIndex via the standard CallbackManager interface. Receipts emit to a side channel (log, queue, or webhook) — your LLM/RAG response is byte-for-byte unchanged.
What this is NOT
Read this carefully before deploying.
- No claim of regulator endorsement. Neither the EU AI Office, ENISA, nor any Member State authority has endorsed this adapter or the LedgerProof protocol.
- No Article 40 presumption of conformity. LedgerProof is not a harmonised standard. Use of this adapter does not create a presumption of conformity with the AI Act.
- Scope is narrow. This adapter provides an evidence layer for Article 50 (transparency obligations for providers and deployers of certain AI systems). It does NOT cover:
- Article 9 (risk management system)
- Article 10 (data and data governance)
- Article 13 (transparency and provision of information to deployers)
- Article 15 (accuracy, robustness, cybersecurity)
- Article 72 (post-market monitoring)
- No LlamaIndex Inc. affiliation. This is an independent integration. LlamaIndex is a registered trademark of LlamaIndex, Inc.
Install
pip install ledgerproof-llamaindex
For the RAG examples:
pip install "ledgerproof-llamaindex[examples]"
5-minute quickstart (RAG)
from llama_index.core import VectorStoreIndex, SimpleDirectoryReader, Settings
from llama_index.core.callbacks import CallbackManager
from llamaindex_ledgerproof import LedgerProofCallbackHandler
from llamaindex_ledgerproof.emitter import LogEmitter
from llamaindex_ledgerproof.signer import Ed25519Signer
handler = LedgerProofCallbackHandler(
deployer_id="acme-bank-eu",
signer=Ed25519Signer.ephemeral(), # production: HSM-backed
emitter=LogEmitter(),
article="50(1)", # disclosure: user interacting with AI
)
Settings.callback_manager = CallbackManager([handler])
docs = SimpleDirectoryReader("./data").load_data()
index = VectorStoreIndex.from_documents(docs)
query_engine = index.as_query_engine()
response = query_engine.query("What is the refund policy?")
print(response) # response payload is UNCHANGED
# Receipt has been emitted to the configured side channel.
C1–C8 protocol discipline
This adapter respects the LedgerProof protocol invariants:
| Invariant | Enforcement here |
|---|---|
| C1 No regulator-endorsement claims | Documented above; no marketing copy in code paths |
| C4 Local verification only | Adapter never phones home to LedgerProof servers in normal operation |
| C6 Stream-aware signing | Transcript hash committed on event-start, signed on event-end. Streaming bodies are not buffered |
| C7 Side-channel emission | The LlamaIndex response object is never mutated. Receipts emit to log/queue/webhook only |
Emitters
from llamaindex_ledgerproof.emitter import LogEmitter, WebhookEmitter, QueueEmitter
LogEmitter() # writes JSON to a Python logger
WebhookEmitter("https://receipts.acme.eu/v1") # POSTs canonical CBOR
QueueEmitter(my_queue) # puts onto any queue.Queue
Receipt schemas
rag_chatbot_session/v1— Article 50(1) RAG chatbot disclosure with retrieval-context hash.generated_content/v1— Article 50(2) generated-content marking.rag_synthesized_response/v1— Article 50(1) synthesized response with source attribution.
See llamaindex_ledgerproof/schema.py.
Production hardening checklist
The MVP ships with ephemeral signing keys. Before production:
- Replace
Ed25519Signer.ephemeral()with HSM-backed key (AWS KMS / GCP Cloud HSM / on-prem Luna). - Move from
LogEmittertoQueueEmitterorWebhookEmitterwith retry + dead-letter. - Configure your Merkle-batcher + Bitcoin anchorer (separate service; not part of this adapter).
- Run GDPR DPIA on
deployer_idand anysubject_pseudonymfields. - Pin
ledgerproof-llamaindexandllama-index-coreversions in your lockfile.
License
Apache License 2.0. See LICENSE.
Foundation
LedgerProof is stewarded by the LedgerProof Foundation — a US 501(c)(3) Delaware non-profit (in formation) with a Dutch Stichting EU subsidiary (in formation). The protocol specification and reference adapters are open-source.
Contact: engineering@ledgerproof.org
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 llamaindex_ledgerproof-0.1.1.tar.gz.
File metadata
- Download URL: llamaindex_ledgerproof-0.1.1.tar.gz
- Upload date:
- Size: 23.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be5937f6fcbda4f598c69baefa1a861ed1d186b8d402e2d89c4809bd0b80e79b
|
|
| MD5 |
c326e8ee6529c4157bb70b9216bbfb6f
|
|
| BLAKE2b-256 |
ec9ce442bf0255275551b087a1d99ab4a87b26024e4593e05c12abdfc2ef4505
|
File details
Details for the file llamaindex_ledgerproof-0.1.1-py3-none-any.whl.
File metadata
- Download URL: llamaindex_ledgerproof-0.1.1-py3-none-any.whl
- Upload date:
- Size: 20.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a43914a3a7e8dd8754bf80f29245e754f55fe2646bc229ba33bd245a309db861
|
|
| MD5 |
5734f4b627ee7ae9f572c0ebab682721
|
|
| BLAKE2b-256 |
ac3348b398ad3b604b04d600775b746c8405e48a55afc24337ee470ea029b23c
|