HDP (Human Delegation Provenance) middleware for AutoGen — cryptographic audit trail for multi-agent delegation
Project description
hdp-autogen
HDP (Human Delegation Provenance) middleware for AutoGen — attach a cryptographic audit trail to any multi-agent conversation with zero changes to your existing code.
Every speaker turn in an AutoGen GroupChat is recorded in a tamper-evident chain of Ed25519 signatures, verifiable offline with a single public key.
pip install hdp-autogen
Quick start
from cryptography.hazmat.primitives.asymmetric.ed25519 import Ed25519PrivateKey
from autogen import ConversableAgent, GroupChat, GroupChatManager
from hdp_autogen import HdpMiddleware, HdpPrincipal, ScopePolicy, verify_chain
# 1. Your signing key (store in a secrets manager, never in code)
private_key = Ed25519PrivateKey.generate()
# 2. Define what the human is authorising
scope = ScopePolicy(
intent="Coordinate research agents to summarise recent papers",
authorized_tools=["web_search", "file_reader"],
max_hops=10,
)
# 3. Create the middleware
middleware = HdpMiddleware(
signing_key=private_key.private_bytes_raw(),
session_id="research-2026-q1",
principal=HdpPrincipal(id="researcher@lab.edu", id_type="email"),
scope=scope,
)
# 4. Build your agents as normal
researcher = ConversableAgent("researcher", ...)
reviewer = ConversableAgent("reviewer", ...)
groupchat = GroupChat(agents=[researcher, reviewer], messages=[])
manager = GroupChatManager(groupchat=groupchat, ...)
# 5. Attach HDP — one line, zero agent changes
middleware.configure(manager)
manager.run_chat(messages=[{"role": "user", "content": "Summarise recent LLM papers"}])
# 6. Verify the delegation chain offline
result = verify_chain(middleware.export_token(), private_key.public_key())
print(result.valid, result.hop_count, result.violations)
Five design considerations
| # | Consideration | How it's handled |
|---|---|---|
| 1 | Scope enforcement | Incoming messages are inspected for tool calls against authorized_tools. Default: logs + records violation in token. strict=True: raises HDPScopeViolationError. |
| 2 | Delegation depth | ScopePolicy(max_hops=N) enforced per conversation; hops beyond the limit are skipped and logged. |
| 3 | Token size / performance | Ed25519 signatures are 64 bytes each (~2.6 KB for a 10-hop chat). All HDP operations are non-blocking — failures log as warnings, agents always continue. |
| 4 | Verification | verify_chain(token, public_key) validates root + every hop signature offline. Returns VerificationResult with valid, hop_count, violations, and per-hop outcomes. |
| 5 | GroupChat integration | configure() detects ConversableAgent vs GroupChatManager and attaches the appropriate hooks. Each speaker turn = one delegation hop. |
API reference
HdpMiddleware
HdpMiddleware(
signing_key: bytes, # Ed25519 private key (raw 32 bytes)
session_id: str, # unique ID for this conversation
principal: HdpPrincipal, # the human delegating authority
scope: ScopePolicy, # what is authorised
key_id: str = "default", # label stored in the token header
expires_in_ms: int = 86400000,
strict: bool = False, # True → raise on scope violations
)
| Method | Description |
|---|---|
configure(target) |
Attach hooks to a ConversableAgent, GroupChatManager, or list of agents |
export_token() |
Return the token dict (or None before first message) |
export_token_json() |
Return the token as a JSON string |
verify_chain(token, public_key)
result = verify_chain(token_dict, public_key) # Ed25519PublicKey or raw bytes
result.valid # bool
result.hop_count # int
result.violations # list[str]
result.hop_results # list[HopVerification]
ScopePolicy
ScopePolicy(
intent: str,
data_classification: str = "internal", # "public" | "internal" | "confidential" | "restricted"
network_egress: bool = True,
persistence: bool = False,
authorized_tools: list[str] | None = None,
authorized_resources: list[str] | None = None,
max_hops: int | None = None,
)
Error handling
By default, HDP middleware is non-blocking — signing or scope-check failures are logged as warnings and the agent continues normally. Violations are recorded in the token's hop metadata for post-hoc audit.
# Default (non-blocking): violations are logged, agents keep running
middleware = HdpMiddleware(
signing_key=key, session_id="s1",
principal=HdpPrincipal(id="alice", id_type="handle"),
scope=ScopePolicy(intent="research", authorized_tools=["web_search"]),
)
middleware.configure(agent)
# If the agent calls an unauthorised tool (e.g. "execute_code"),
# → WARNING is logged, violation attached to the hop record
# → agent execution is NOT interrupted
# Strict mode: violations raise immediately
middleware_strict = HdpMiddleware(
signing_key=key, session_id="s1",
principal=HdpPrincipal(id="alice", id_type="handle"),
scope=ScopePolicy(intent="research", authorized_tools=["web_search"]),
strict=True,
)
middleware_strict.configure(agent)
# If the agent calls "execute_code" → raises HDPScopeViolationError
After a session, inspect violations via the token:
token = middleware.export_token()
for hop in token["delegation_chain"]:
if hop.get("violation"):
print(f"Hop {hop['seq']}: {hop['violation']}")
Cross-language compatibility
Python and TypeScript HDP tokens use the same wire format (RFC 8785 canonical JSON + Ed25519). A token issued by hdp-autogen (Python) can be verified by @helixar_ai/hdp (TypeScript) and vice versa — useful in mixed environments where some agents run in Python and others in Node.js.
# Python: export token
token_json = middleware.export_token_json()
# → pass to TypeScript service via API, message queue, etc.
// TypeScript: verify a token issued by Python
import { verifyChain } from "@helixar_ai/hdp";
const result = verifyChain(JSON.parse(tokenJson), publicKey);
Releasing
Published to PyPI via GitHub Actions when a matching tag is pushed:
git tag python/hdp-autogen/v0.1.2 && git push origin python/hdp-autogen/v0.1.2
Pipeline: test-hdp-autogen → vet-hdp-autogen (ReleaseGuard) → publish-hdp-autogen
| Detail | Value |
|---|---|
| PyPI project | hdp-autogen |
| Tag pattern | python/hdp-autogen/v* |
| Workflow | .github/workflows/release.yml |
| Auth | OIDC trusted publisher (no token needed) |
| Environment | pypi-hdp-autogen |
Spec
Human Delegation Provenance (HDP) is an IETF draft: draft-helixar-hdp-agentic-delegation
License
Apache License 2.0 — Helixar Limited
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 hdp_autogen-0.1.3.tar.gz.
File metadata
- Download URL: hdp_autogen-0.1.3.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7737fc908eb565682b09bf87207949a672e9661f33efac26f066893a71ad896a
|
|
| MD5 |
c5567edfc1f9734c919cb990f9013c25
|
|
| BLAKE2b-256 |
e54b6d1bcdf3585fc7b00d07081c32e010c709c707fdb9aa6457d587c8fb021c
|
Provenance
The following attestation bundles were made for hdp_autogen-0.1.3.tar.gz:
Publisher:
release.yml on Helixar-AI/HDP
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hdp_autogen-0.1.3.tar.gz -
Subject digest:
7737fc908eb565682b09bf87207949a672e9661f33efac26f066893a71ad896a - Sigstore transparency entry: 1393321319
- Sigstore integration time:
-
Permalink:
Helixar-AI/HDP@4da27f10834deaddc9ebc85af4962aa518d058eb -
Branch / Tag:
refs/tags/python/hdp-autogen/v0.1.3 - Owner: https://github.com/Helixar-AI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4da27f10834deaddc9ebc85af4962aa518d058eb -
Trigger Event:
push
-
Statement type:
File details
Details for the file hdp_autogen-0.1.3-py3-none-any.whl.
File metadata
- Download URL: hdp_autogen-0.1.3-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a31e7ed9338ede4344d762e9f2a5c47ad85f51b1107bf28ca7f7d5f4780b8ca
|
|
| MD5 |
44b53d658255825305eb988bd69d3253
|
|
| BLAKE2b-256 |
90f6b2023a3987d1352ef1c02881ba33646aabc6b23521aec60b5d2346f9fc71
|
Provenance
The following attestation bundles were made for hdp_autogen-0.1.3-py3-none-any.whl:
Publisher:
release.yml on Helixar-AI/HDP
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hdp_autogen-0.1.3-py3-none-any.whl -
Subject digest:
1a31e7ed9338ede4344d762e9f2a5c47ad85f51b1107bf28ca7f7d5f4780b8ca - Sigstore transparency entry: 1393321349
- Sigstore integration time:
-
Permalink:
Helixar-AI/HDP@4da27f10834deaddc9ebc85af4962aa518d058eb -
Branch / Tag:
refs/tags/python/hdp-autogen/v0.1.3 - Owner: https://github.com/Helixar-AI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@4da27f10834deaddc9ebc85af4962aa518d058eb -
Trigger Event:
push
-
Statement type: