Skip to main content

Deterministic governance callbacks for Google Agent Development Kit (ADK) — policy enforcement, PII detection, cost tracking, and audit evidence.

Project description

tealtiger-adk

Deterministic governance callbacks for Google Agent Development Kit (ADK) — policy enforcement, PII detection, cost tracking, and audit evidence for Gemini-powered agents.

PyPI License Python 3.10+

Part of the TealTiger ecosystem — deterministic AI agent governance.


Features

  • 🛡️ PII Detection — Block SSN, credit cards, emails, phone numbers, IP addresses in tool arguments
  • 🔑 Secret Detection — Prevent API keys (OpenAI, GitHub, AWS, Google, Groq) from leaking through tools
  • 💰 Cost Tracking — Per-session budget limits with automatic enforcement
  • 🔧 Tool Allowlisting — Restrict which tools agents can call (supports wildcards)
  • ❄️ Kill Switch — Instantly freeze/unfreeze an agent's tool access
  • 📋 Audit Trail — Complete decision log with correlation IDs, timestamps, and risk scores
  • Sub-millisecond — Deterministic evaluation, no LLM in the governance path

Installation

pip install tealtiger-adk

Quick Start

from google.adk import Agent
from tealtiger_adk import TealTigerCallback

# Create governance callback
governance = TealTigerCallback(
    policies=[
        {"type": "pii_block", "categories": ["ssn", "credit_card", "email"]},
        {"type": "cost_limit", "max_per_session": 5.00},
        {"type": "tool_allowlist", "allowed": ["google_search", "code_*"]},
        {"type": "secret_detection"},
    ],
    mode="ENFORCE",  # OBSERVE | MONITOR | ENFORCE
)

# Attach to ADK agent
agent = Agent(
    model="gemini-2.0-flash",
    name="research_agent",
    tools=[google_search, code_execution],
    before_tool_callback=governance.before_tool,
    after_tool_callback=governance.after_tool,
)

# Run your agent normally — governance is transparent
response = agent.run("Find the latest AI safety research papers")

# Inspect governance decisions
print(f"Total decisions: {len(governance.decisions)}")
print(f"Denied: {governance.deny_count}")
print(f"Cost tracked: ${governance.total_cost:.4f}")

Governance Modes

Mode Behavior
OBSERVE Log decisions only — never blocks tool calls
MONITOR Log decisions with warnings — never blocks
ENFORCE Log decisions AND block denied tool calls

Policy Types

PII Detection

{"type": "pii_block", "categories": ["ssn", "credit_card", "email", "phone", "ip_address"]}

Scans tool arguments for PII patterns. In ENFORCE mode, blocks the tool call and returns a governance denial message to the agent.

Cost Limits

{"type": "cost_limit", "max_per_session": 10.00}

Tracks cumulative cost per session. Blocks further tool calls once the budget is exhausted.

Tool Allowlisting

{"type": "tool_allowlist", "allowed": ["google_search", "code_*", "read_file"]}

Only allows tools matching the allowlist. Supports wildcard patterns (code_* matches code_execution, code_review, etc.).

Secret Detection

{"type": "secret_detection"}

Detects API keys and tokens (OpenAI sk-*, GitHub ghp_*, AWS AKIA*, Google AIza*, Groq gsk_*) in tool arguments.

Kill Switch

# Emergency freeze — blocks ALL tool calls regardless of policy
governance.freeze()

# Resume normal governance
governance.unfreeze()

# Check status
print(governance.is_frozen)  # True/False

Decision Audit Trail

Every governance evaluation produces a structured decision:

{
    "correlation_id": "550e8400-e29b-41d4-a716-446655440000",
    "timestamp_ms": 1720000000000.0,
    "action": "DENY",
    "mode": "ENFORCE",
    "tool_name": "send_email",
    "agent_id": "adk-agent-a1b2c3d4",
    "reason_codes": ["PII_DETECTED:ssn"],
    "risk_score": 90,
    "evaluation_time_ms": 0.042,
    "cost_tracked": 0.0,
    "cumulative_cost": 0.008,
}

Integration with TealTiger Ecosystem

tealtiger-adk works standalone, but also integrates with the full TealTiger platform:

from tealtiger_adk import TealTigerCallback

# Stream decisions to your observability stack
def send_to_dashboard(decision):
    # Forward to TealTiger Dashboard, Langfuse, AgentOps, etc.
    requests.post("https://your-dashboard/api/decisions", json=decision)

governance = TealTigerCallback(
    policies=[...],
    mode="ENFORCE",
    on_decision=send_to_dashboard,
)

Requirements

  • Python 3.10+
  • tealtiger >= 1.1.0
  • google-adk >= 0.1.0 (for running agents)

Links

License

Apache 2.0 — see LICENSE.

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

tealtiger_adk-0.1.0.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

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

tealtiger_adk-0.1.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file tealtiger_adk-0.1.0.tar.gz.

File metadata

  • Download URL: tealtiger_adk-0.1.0.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for tealtiger_adk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ed909873ea13e7625bc286e9ad92aa52cf8d62e4adeee2e777f34f15acf51aba
MD5 785f0d961c4083f7c85d8ccc6f65a6a1
BLAKE2b-256 c5c82056361366e89a0b5960291e3f52e1d487dc3d4b3afdb5ea9ecef5551f7e

See more details on using hashes here.

File details

Details for the file tealtiger_adk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tealtiger_adk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for tealtiger_adk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eea24816e0865e064d2f3bce7fe5a0a1a76cd40bd8848008a27800319fbf9877
MD5 623773268238398135f99635d07e35be
BLAKE2b-256 bf03a69619e50213067be3092e4c7adede5e62820d4bc9904a4780d4e9c17c59

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