ledgerproof-langchain
LangChain and LangGraph adapter for the LedgerProof protocol. Emits cryptographically signed transparency receipts as a side channel, suitable for evidence of EU AI Act Article 50 disclosure obligations.
Install
pip install ledgerproof-langchain
# Optional LangGraph support:
pip install "ledgerproof-langchain[langgraph]"
Python 3.10+.
5-minute quickstart (callback handler)
from langchain_openai import ChatOpenAI
from langchain_ledgerproof import LedgerProofCallbackHandler, LogEmitter
handler = LedgerProofCallbackHandler(
deployer_id="acme-corp-eu",
schema="chatbot_session/v1",
emitter=LogEmitter("./receipts.jsonl"),
)
llm = ChatOpenAI(model="gpt-4o-mini", callbacks=[handler])
llm.invoke("Hello, are you an AI?")
# Receipt appended to ./receipts.jsonl. LLM response is not modified.
See examples/01_chatbot_quickstart.py and examples/02_langgraph_editorial.py.
What this adapter does
- Captures a stream-aware SHA-256 transcript hash of the LLM interaction (commit-on-start, sign-on-end — never buffers the full body).
- Signs the receipt with Ed25519.
- Emits the receipt via a pluggable side channel (file, webhook, in-process queue).
- Validates receipt structure against one of three Pydantic schemas:
chatbot_session/v1(Article 50(1) — AI interaction disclosure)generated_content/v1(Article 50(2) — AI-generated content marking)human_review/v1(Article 50(4) — editorial-control exemption)
- Supports both legacy LangChain callbacks and LangGraph node middleware.
What this adapter explicitly does NOT do
- Does not modify the LLM response payload. Receipts are side-channel only.
- Does not phone home during verification. Verification is offline against the Bitcoin chain and the published protocol public key.
- Does not provide Article 9 (risk management), Article 10 (data governance), Article 13 (transparency to users beyond Article 50), Article 15 (accuracy / robustness / cybersecurity), or Article 72 (post-market monitoring) coverage.
- Does not claim regulator endorsement.
- Does not claim Article 40 presumption of conformity (no harmonized standard has been published for Article 50 at the time of this release).
- Provides an Article 50 transparency receipt evidence layer only.
Schemas
All three schemas reject email-shaped strings in deployer_id, reviewer_role,
and review_rationale fields as a GDPR safety check. Receipts should reference
opaque pseudonymous identifiers, not personal data.
Phase 2+ roadmap
The MVP signer generates an ephemeral in-memory Ed25519 keypair. Production
deployments will use HSM-backed signing (AWS KMS, GCP Cloud KMS, Azure Key Vault,
YubiHSM). See signer.py for backend stubs.
License
Apache 2.0. See LICENSE.
Metadata
Release files for langchain-ledgerproof 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| langchain_ledgerproof-1.0.1.tar.gz | 19.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_ledgerproof-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.4 kB
Release files / langchain_ledgerproof-1.0.1.tar.gz
| Download URL | langchain_ledgerproof-1.0.1.tar.gz |
|---|---|
| Size | 19.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1eba4e7f0626227ae666e3a17881d228ab13b629593d0b32b0be4f7cab182585
|
|
BLAKE2b-256 checksum How to use checksums |
df2d053a8d87ee7b5bc30f9059d051bd1dc443b7eb1ba2dd464efdc050e42d38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / langchain_ledgerproof-1.0.1-py3-none-any.whl
| Download URL | langchain_ledgerproof-1.0.1-py3-none-any.whl |
|---|---|
| Size | 18.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aafac1875a709c1ab5c239612cc673b98c7a7e0ec1e2ac62c4da59e750944964
|
|
BLAKE2b-256 checksum How to use checksums |
3a1e4fe3f3a47c70616569ff2274e8c9883709d19a5f9258e41d6d15d16dda7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Security for langchain-ledgerproof 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.