Skip to content

feat: add AgentGovernancePlugin for tool-call governance#141

Open
imran-siddique wants to merge 1 commit into
google:mainfrom
imran-siddique:feat/agt-governance-plugin
Open

feat: add AgentGovernancePlugin for tool-call governance#141
imran-siddique wants to merge 1 commit into
google:mainfrom
imran-siddique:feat/agt-governance-plugin

Conversation

@imran-siddique
Copy link
Copy Markdown

Adds an ADK plugin that integrates microsoft/agent-governance-toolkit for centralized tool-call policy enforcement.

This replaces #117, fully addressing review feedback from @DeanChensj and the Gemini code review.

What changed vs #117

Feedback Resolution
Wrong copyright (Microsoft/MIT) Apache 2.0 / Google LLC throughout
Wrong plugin API (sync, custom interface) Extends BasePlugin, async before_tool_callback
Wrong return semantics Returns None (allow) or dict (short-circuit deny) per ADK contract
Fail-open default Fail-closed by default; opt-in fail_open=True
Unreliable policy_dir path Required param, resolved to absolute
Wrong file location Plugin in src/google/adk_community/plugins/, sample in contributing/samples/
No tests 11 tests covering allow/deny/fail-open/missing-dep/audit/custom-agent-did

Files

  • src/google/adk_community/plugins/agent_governance_plugin.py - the plugin
  • src/google/adk_community/plugins/__init__.py - public exports
  • tests/plugins/test_agent_governance_plugin.py - 11 tests
  • contributing/samples/agent_governance/ - usage example + sample policies

Usage

from google.adk_community.plugins import AgentGovernancePlugin
from google.adk.runners import Runner

plugin = AgentGovernancePlugin(policy_dir="./policies")
runner = Runner(agent=agent, plugins=[plugin], app_name="my_app", session_service=sessions)

Requires agentmesh-platform (pip install agentmesh-platform).

@imran-siddique
Copy link
Copy Markdown
Author

@DeanChensj this replaces #117 with a full rewrite addressing all your review feedback. Key changes: correct BasePlugin extension, async before_tool_callback, Apache 2.0 copyright, fail-closed default, proper file placement, and 11 tests. Would appreciate another look when you get a chance.

@google-cla
Copy link
Copy Markdown

google-cla Bot commented May 19, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@imran-siddique imran-siddique force-pushed the feat/agt-governance-plugin branch from 24a3004 to 9a2492c Compare May 19, 2026 19:57
@giskard09
Copy link
Copy Markdown

The fail-closed default is the right call — fail-open governance plugins are security theater.

One gap worth noting: before_tool_callback covers the pre-execution decision (allow/deny), but the audit record stays in the Python process. If the agent restarts, the log rotates, or an external auditor needs to verify what actually executed — there's no independently verifiable anchor.

Mycelium Trails closes that loop: after before_tool_callback allows the call, a single POST /nexus/trail anchors the outcome on Base (Arbitrum L2). The anchor is independently verifiable without trusting the operator. Published on the Official MCP Registry (io.github.giskard09/argentum).

Would it make sense to add an optional audit_backend param so operators can plug in an external anchor? Happy to sketch the interface if useful.

@imran-siddique
Copy link
Copy Markdown
Author

I have signed the CLA.

Integrates microsoft/agent-governance-toolkit (AGT) as an ADK
BasePlugin for centralized tool-call policy enforcement.

- Extends BasePlugin with async before_tool_callback
- Evaluates tool calls against YAML policy rules via agentmesh PolicyEngine
- Returns None (allow) or dict (deny/short-circuit) per ADK contract
- Fail-closed by default; opt-in fail_open=True for graceful degradation
- Structured audit logging for all policy decisions
- 11 tests covering allow/deny/fail-open/missing-dep/custom-agent-did

Signed-off-by: Imran Siddique <imran.siddique@microsoft.com>
@imran-siddique imran-siddique force-pushed the feat/agt-governance-plugin branch from 9a2492c to cb54108 Compare May 20, 2026 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants