Skip to main content

Public Preview — Agent Governance Toolkit integration for Google ADK: policy enforcement, trust verification, and audit trails for ADK agents

Project description

ADK AgentMesh — Governance for Google ADK Agents

[!IMPORTANT] Public Preview — The adk-agentmesh package on PyPI is a Microsoft-signed public preview release. APIs may change before GA.

Policy enforcement, trust verification, and audit trails for Google ADK agents — powered by the Agent Governance Toolkit.

What It Does

adk-agentmesh implements the PolicyEvaluator protocol (google/adk-python#4897) backed by the Agent Governance Toolkit's deterministic policy engine.

  • Tool-level governance — block, allow-list, or require approval for any ADK tool call
  • Rate limiting — cap tool calls per agent per session
  • Delegation scope — monotonic narrowing ensures sub-agents never exceed parent permissions
  • Structured audit — every decision is logged with verdict, rule, and timestamp

Installation

pip install adk-agentmesh

Quick Start

1. Define a governance policy

Create a YAML policy file (see examples/policies/adk-governance.yaml):

adk_governance:
  blocked_tools:
    - execute_shell
    - delete_database
  max_tool_calls: 100
  require_approval_for:
    - send_email
    - deploy_service

2. Wire into your ADK agent

from adk_agentmesh import ADKPolicyEvaluator, GovernanceCallbacks

# Load policy
evaluator = ADKPolicyEvaluator.from_config("policies/adk-governance.yaml")
callbacks = GovernanceCallbacks(evaluator)

# Attach to ADK agent
from google.adk.agents import LlmAgent

agent = LlmAgent(
    model="gemini-2.0-flash",
    name="my-governed-agent",
    before_tool_callback=callbacks.before_tool,
    after_tool_callback=callbacks.after_tool,
    before_agent_callback=callbacks.before_agent,
    after_agent_callback=callbacks.after_agent,
)

3. Or use the evaluator directly

import asyncio
from adk_agentmesh import ADKPolicyEvaluator

evaluator = ADKPolicyEvaluator(
    blocked_tools=["execute_shell"],
    max_tool_calls=50,
    require_approval_for=["send_email"],
)

decision = asyncio.run(
    evaluator.evaluate_tool_call(
        tool_name="search_web",
        tool_args={"query": "latest news"},
        agent_name="research-agent",
    )
)
print(decision.verdict)  # Verdict.ALLOW

ADK Lifecycle Mapping

ADK Hook Governance Check
before_tool_callback Policy evaluation, rate limiting, tool blocking
after_tool_callback Audit logging
before_agent_callback Delegation scope check
after_agent_callback Delegation audit

Delegation Scope Narrowing

Sub-agents automatically receive narrowed permissions:

from adk_agentmesh import DelegationScope

parent_scope = DelegationScope(
    allowed_tools=["search_web", "read_file", "write_file"],
    max_tool_calls=100,
    max_depth=3,
)

# Child gets strictly fewer permissions
child_scope = parent_scope.narrow(
    allowed_tools=["search_web", "read_file"],
    read_only=True,
)
# child_scope.max_depth == 2 (always decrements)
# child_scope.read_only == True (once set, cannot be unset)

Audit Events

Every governance decision is recorded:

evaluator = ADKPolicyEvaluator(blocked_tools=["dangerous_tool"])

# ... after agent runs ...

for entry in evaluator.get_audit_log():
    print(entry["event"], entry["timestamp"])

For structured audit handling:

from adk_agentmesh import AuditEvent, LoggingAuditHandler

handler = LoggingAuditHandler()
event = AuditEvent(
    event_type="tool_call_denied",
    agent_name="my-agent",
    tool_name="execute_shell",
    verdict="deny",
    reason="Tool is blocked by policy",
)
handler.handle(event)

Sample Policy

See the full sample policy at examples/policies/adk-governance.yaml.

Links

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

adk_agentmesh-3.3.0.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

adk_agentmesh-3.3.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file adk_agentmesh-3.3.0.tar.gz.

File metadata

  • Download URL: adk_agentmesh-3.3.0.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: RestSharp/106.13.0.0

File hashes

Hashes for adk_agentmesh-3.3.0.tar.gz
Algorithm Hash digest
SHA256 2e9eca4843649c8e3921b7912a90b2da7f72f6010c1c031b02b502aa33d45de1
MD5 5ee0dc4aad9b6e6ba3e428e500d96083
BLAKE2b-256 24c588ce5c3c062347b5371542ffad29b5f82fd3fe6eb36bccbabc2fe73c311a

See more details on using hashes here.

File details

Details for the file adk_agentmesh-3.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for adk_agentmesh-3.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4b8a7d76a64f2827b77c8daed918ecfde1ad2f6563fcd9203853a5cc8b7cbb66
MD5 b8b6d9043d590d1af349f790140f3437
BLAKE2b-256 588afab6264fe205befa6495cc239634e84b0d2af9be1727f9db6dd8252fda50

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page