Add Gemma 4 + HDP agentic security example (FunctionGemma/)#342
Open
asiridalugoda wants to merge 5 commits intogoogle-gemma:mainfrom
Open
Add Gemma 4 + HDP agentic security example (FunctionGemma/)#342asiridalugoda wants to merge 5 commits intogoogle-gemma:mainfrom
asiridalugoda wants to merge 5 commits intogoogle-gemma:mainfrom
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Author
|
Pushed a formatting fix, notebook failed the CI arxiv article : https://arxiv.org/abs/2604.04522 |
Author
|
Hey @bebechien, pushed a formatting fix for the |
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 a cookbook example demonstrating how to integrate the Human Delegation Provenance (HDP) protocol with Gemma 4's native function-calling to cryptographically verify that every tool invocation was authorized by a human principal before execution.
Placed in
FunctionGemma/as it extends Gemma 4's function-calling capability with a security layer.Problem
Gemma 4 is purpose-built for agentic workflows with native function-calling. This creates an underaddressed security gap: when Gemma 4 generates a function call, there is no verifiable record that a human principal authorized that specific action. A compromised system prompt or injected instruction can trigger tool calls that are indistinguishable from legitimate delegation at the tool interface.
This is particularly acute for Gemma 4 E2B/E4B deployments on edge devices (Jetson Nano, Raspberry Pi) directing physical actuators offline with no out-of-band authorization check.
Solution
This example integrates HDP (IETF individual draft
draft-helixar-hdp-agentic-delegation-00) as a middleware gate between Gemma 4's function-call output and tool execution:HDPMiddleware.gate()before executionFiles added
Irreversibility classes
Testing
Middleware logic (
HDPMiddleware,HDPDelegationToken,IrreversibilityClass) is self-contained and tested independently of the model. The notebook is designed forgoogle/gemma-4-E4B-itvia HuggingFace Transformers — function call outputs are simulated in the demo cells to allow verification logic to be evaluated without GPU access.References