Skip to main content

llama-index-callbacks-hdp

HDP (Human Delegation Provenance) integration for LlamaIndex, with cryptographic records of agent and RAG activity.

HDP complements observability tools like Arize Phoenix and Langfuse with an offline-verifiable record of the issuer-declared delegation context and subsequent signed chain entries.

Every tool call, retrieval step, and LLM invocation is recorded in a tamper-evident, cryptographically signed delegation chain. The chain is verifiable offline without network calls or a central registry. HDP tokens are records and cannot gate actions.

Installation

pip install llama-index-callbacks-hdp

Usage

Option 1 — Modern instrumentation dispatcher (LlamaIndex ≥0.10.20)

from llama_index.callbacks.hdp import HdpInstrumentationHandler, HdpPrincipal, ScopePolicy

HdpInstrumentationHandler.init(
    signing_key=ed25519_private_key_bytes,
    principal=HdpPrincipal(id="alice@corp.com", id_type="email"),
    scope=ScopePolicy(
        intent="Research pipeline",
        authorized_tools=["web_search", "retriever"],
        max_hops=10,
    ),
    on_token_ready=lambda token: print(token["header"]["token_id"]),
)

Option 2 — Legacy CallbackManager

from llama_index.callbacks.hdp import HdpCallbackHandler, HdpPrincipal, ScopePolicy
from llama_index.core import Settings
from llama_index.core.callbacks import CallbackManager

handler = HdpCallbackHandler(
    signing_key=ed25519_private_key_bytes,
    principal=HdpPrincipal(id="alice@corp.com", id_type="email"),
    scope=ScopePolicy(intent="Research pipeline"),
)
Settings.callback_manager = CallbackManager([handler])

Option 3: Node postprocessor (retrieval audit recording)

from llama_index.callbacks.hdp import HdpNodePostprocessor

postprocessor = HdpNodePostprocessor(
    signing_key=ed25519_private_key_bytes,
    check_data_classification=True,
)
query_engine = index.as_query_engine(node_postprocessors=[postprocessor])

The postprocessor returns every node. Nodes above the declared data_classification are recorded as violations when a signing key is configured and the chain has capacity under max_hops. The deprecated strict=True and instrumentation's on_violation="raise" options raise ValueError during construction. HDPScopeViolationError remains importable but is deprecated and never raised.

Verifying a token

from llama_index.callbacks.hdp import verify_chain

result = verify_chain(token_dict, public_key_bytes)
if result.valid:
    print(f"Chain verified: {result.hop_count} hops")
print(result.recorded_after_period)  # hop seq values at or after expires_at

result.valid reports integrity only. Expiry does not affect it; recorded_after_period reports hops whose timestamps are at or after the authorization period.

What makes HDP different from Arize/Langfuse?

Capability Arize / Langfuse HDP
Records what happened ✓ ✓
Records issuer-declared delegation context ✗ ✓
Cryptographically signed ✗ ✓
Verifiable offline ✗ ✓
Scope declaration and violation records ✗ ✓
No central registry n/a ✓

Specification

This package follows draft-helixar-hdp-agentic-delegation-03 (latest revision).

License

Apache-2.0

Metadata

Release files for llama-index-callbacks-hdp 0.2.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 llama-index-callbacks-hdp 0.2.0
File Size Uploaded
llama_index_callbacks_hdp-0.2.0.tar.gz 20.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-callbacks-hdp 0.2.0
File Interpreter ABI Platform
llama_index_callbacks_hdp-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 40.5 kB

Release files / llama_index_callbacks_hdp-0.2.0.tar.gz

Download URL llama_index_callbacks_hdp-0.2.0.tar.gz
Size 20.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4622c045e505c66bbeadae2c27def21fe5f8df5218e22bfb953aa763df43c8d0
BLAKE2b-256 checksum
How to use checksums
6fc819aecbffbae653adfb6d61cf08945f797ab38beac06ee9a3a56066e6abb9
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 Oct 7, 2026.

Transparency log

Release files / llama_index_callbacks_hdp-0.2.0-py3-none-any.whl

Download URL llama_index_callbacks_hdp-0.2.0-py3-none-any.whl
Size 19.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
628efe1dd36e43f72ad603b698d97a4a4a3d7c21543836ca58889f473eec526c
BLAKE2b-256 checksum
How to use checksums
8388410ffa04aaa597a56b3d9924eb196d08276c624d9078efc2ece34a6d6d80
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 Oct 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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