Skip to main content

hornet-cpl (Python SDK and CLI)

Signed, chained provenance receipts for AI work, verifiable offline.

hornet-cpl emits and verifies CPL records: small JSON provenance receipts that say who or what produced an AI output (a model, agent, tool or person), from which inputs, through which operation, and what came out. Every input is bound by hash, prompts are only ever hashed, and records are canonicalized (RFC 8785), hashed (SHA-256) and signed (Ed25519). Records chain into a tamper-evident DAG that anyone holding your public key can verify offline, with no call back to your systems.

This package implements the CPL/PEL v0.2 draft specification. A TypeScript implementation of the same format is published on npm as hornet-cpl.

Install

pip install "hornet-cpl[sign]"

Python 3.10 or later. The core has no runtime dependencies: hashing, canonicalization, record building and the checks that precede signature verification use only the standard library. The sign extra adds cryptography, which is needed to generate keys, sign, and run the final Ed25519 check of verification. Without it, hornet_cpl.SIGNING_AVAILABLE is False and those functions raise a clear error.

Python API

Everything below imports from hornet_cpl itself. The top-level names are the same set the TypeScript package exports from its index, in snake_case (verifyBundle is verify_bundle); tests/python/test_public_api.py keeps the two lists in step. The submodules hornet_cpl.chain, hornet_cpl.pel, hornet_cpl.signing, hornet_cpl.trust and hornet_cpl.validator hold the rest.

Area Names What it does
Emitting CPLEmitter, EMPTY_HASH emit(...) builds a record: hashes the content, parameters, prompts (optionally keyed with HMAC) and inputs, links parent records, and signs when given a signer.
Records CPLRecord, Origin, InputRef, Transformation, Context, Parameters, Integrity, Signature, ProducerType, Operation, RefType, ExecutionEnvironment, CPLRecordError, CPL_VERSION, is_valid_timestamp The immutable record model; to_dict(), to_json(), from_dict(), from_json().
Encoding pel canonicalize (RFC 8785 JCS), content_hash, parameters_hash, record_hash, prompt_hash.
Signing Signer, generate_keypair, sign_record, verify_signature, key_id_for, load_private_key Ed25519 signing over the PEL signing input.
Trust load_key_file, TrustStore, PinnedKey, KeyResolver Pinned public keys: a verifier trusts exactly the keys in its own key file.
Verifying a record CPLValidator, validate_record, validate_record_bytes, ValidationReport, parse_strict, check_record_model, check_value, Finding The PEL verification procedure; returns a report with valid, error_code, error_path, signed and more.
Chains and bundles collect, verify_bundle, MemoryRecordStore, DirectoryRecordStore, RecordStore, ChainReport, CollectError, BUNDLE_VERSION, DEFAULT_LIMITS Collect a record and its complete ancestry into a bundle; verify a bundle against a key file and the artifact bytes.
from hornet_cpl import (CPLEmitter, MemoryRecordStore, Signer, collect, generate_keypair,
                        key_id_for, pel, validate_record_bytes, verify_bundle)

private_key, public_key = generate_keypair()
signer = Signer(private_key, signer_id="example-agent")
keys = pel.canonicalize([{"key_id": key_id_for(public_key), "algorithm": "ed25519",
                          "public_key": public_key, "signer_id": "example-agent"}])

emitter = CPLEmitter()
draft = emitter.emit(producer_type="local_llm", producer_id="ollama:qwen3:8b",
                     operation="generate", content="A draft.",
                     input_prompt="Write a draft.", signer=signer)
final = emitter.emit(producer_type="local_llm", producer_id="ollama:gemma3:4b",
                     operation="summarize", content="Short.",
                     parent_records=[draft], signer=signer)

report = validate_record_bytes(pel.canonicalize(final.to_dict()), trust=keys,
                               content=b"Short.")
assert report.valid and report.signed

store = MemoryRecordStore()
store.put(draft)
store.put(final)
bundle = collect(final, store, name="final.txt")
assert verify_bundle(pel.canonicalize(bundle), keys, artifact=b"Short.").valid

Command line

The package installs the hornet-cpl command:

Command What it does
hornet-cpl keygen --out-private F --out-key-file F [--signer-id S] Create an Ed25519 private key file (mode 0600) and a key file with the pinned public key.
hornet-cpl emit --spec F [--sign-key F --signer-id S] [--hmac-key-file F] Build a record from a JSON spec, optionally signed and with keyed prompt hashes, and print it.
hornet-cpl verify RECORD [--keys F] [--content F] [--require-signature] [--json] Verify a record and print the report.
hornet-cpl hash content|parameters|record|prompt [FILE] Print a PEL hash.
hornet-cpl bundle --subject F --store DIR -o F [--name N] [--keys F] Collect a record and its ancestry from a directory store into a bundle file.
hornet-cpl verify-chain --bundle F --keys F [--artifact F] [--accept-profile chained-only] [--build-info] [--json] Verify a bundle and, with --artifact, that it covers the artifact bytes; print the chain report. --accept-profile chained-only accepts unsigned records that declare that profile; --build-info names the build on stderr.
hornet-cpl key-id --public-key PK [--legacy-compat] Print the key_id of a public key and, with --legacy-compat, the legacy v0.1 identifier a registry may still hold.
hornet-cpl version [--build] Print the SDK and CPL versions and, with --build, the source commit of this build.

Exit status: 0 success or valid, 1 verification failed, 2 usage, input or I/O error. The key-file and spec formats are described in FORMATS.md.

What a record does not claim

A signature attests that the signer observed the producer produce the record; it does not prove that a model actually ran. signed_at is the signer's claim, not a trusted timestamp. CPL signatures are not eIDAS qualified electronic signatures or seals, and nothing here is a conformity assessment: a chain supports evidence for an obligation, it does not comply with one. The full list is in the claims register.

License

Apache-2.0.

SDK stability in 1.0

The documented public SDK and CLI follow semantic versioning. The 1.x verifiers continue to accept existing CPL wire 0.2 bundles and the frozen signed fixtures. Verification dispatches by the declared wire version and rejects unsupported versions.

Python CLI emission specs require origin.producer_version and origin.execution_environment. The TypeScript CLI can default these fields. Set both explicitly in portable emission specs.

Metadata

Release files for hornet-cpl 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hornet-cpl 1.0.0
File Size Uploaded Provenance Actions
hornet_cpl-1.0.0.tar.gz 88.7 kB With provenance Details for hornet_cpl-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hornet-cpl 1.0.0
File Interpreter ABI Platform Actions
hornet_cpl-1.0.0-py3-none-any.whl Python 3 none any Details for hornet_cpl-1.0.0-py3-none-any.whl

Total release size: 186.6 kB

Release files / hornet_cpl-1.0.0.tar.gz

Download URL hornet_cpl-1.0.0.tar.gz
Size 88.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6d9c44d39ff9372bc89efc71998dc2086972bf485335d2fb3e06ce20ba46763c
BLAKE2b-256 checksum
How to use checksums
aa775f805da72a7cfd1b34a426ee759c358237649814d082430b3a8b226d19e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Release files / hornet_cpl-1.0.0-py3-none-any.whl

Download URL hornet_cpl-1.0.0-py3-none-any.whl
Size 97.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3aa30ea512f9d54c349e8fbf0b1f248233571a9030448b1157dc253e67f88f7b
BLAKE2b-256 checksum
How to use checksums
a2f1c476915b6f5e5227b0cf60ad9a2d13c5a5bbcf6fbde1a0b26c9cd9b4aeae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

Security for hornet-cpl 1.0.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hornet_cpl-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 2, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page