feat: add hdp-crewai Python middleware package#5
Merged
asiridalugoda merged 1 commit intomainfrom Mar 27, 2026
Merged
Conversation
Introduces packages/hdp-crewai — a non-blocking CrewAI integration
that attaches HDP delegation provenance to any crew with zero changes
to core CrewAI logic.
Hooks into CrewAI's existing callback system (before_kickoff_callbacks,
step_callback, task_callback, after_kickoff_callbacks) and implements
all five design considerations:
1. Scope enforcement — step_callback inspects AgentAction.tool against
authorized_tools; strict mode raises HDPScopeViolationError, default
mode logs and records the violation in the token audit trail.
2. Delegation depth limits — max_hops enforced per crew execution;
hops beyond the limit are skipped and warned.
3. Token size / performance — Ed25519 = 64 bytes/hop; all HDP
operations are non-blocking (failures log, never raise).
4. Verification utilities — verify_chain() validates the complete
delegation chain offline using only the human's Ed25519 public key.
5. Memory integration — after_kickoff persists the signed token JSON
to CrewAI's storage directory alongside task outputs.
26 tests, all passing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
packages/hdp-crewai— a Python middleware package that attaches HDP delegation provenance to any CrewAI crew with zero changes to CrewAI core.What's included
Five design considerations
step_callbackchecksAgentAction.toolagainstauthorized_tools;strict=TrueraisesHDPScopeViolationError, default logs + records in tokenmax_hopsenforced intask_callback; hops beyond limit are skippedverify_chain(token, public_key)validates chain offlinedb_storage_path()after kickoffRelated