feat: governance hook integration for deterministic tool call authorization (TealTiger)
Summary
I'd like to propose/contribute a governance integration that works with Claude Agent SDK's tool_permission_callback to provide deterministic policy evaluation, cost tracking, and structured audit records for tool calls.
Problem
The existing tool_permission_callback provides a binary allow/deny mechanism, but production deployments need:
- Deterministic policy evaluation (not just manual allow/deny logic)
- Cost tracking per tool call, per session, with budget enforcement
- Structured audit records for compliance
- Per-tool allowlists that can be configured without code changes
- Circuit breaking when tool providers are failing
- A "observe first, enforce later" adoption path
Proposed Integration
from claude_agent_sdk import Agent
from claude_tealtiger import TealTigerPermissionCallback
# Zero-config: observe all tool calls, track cost, detect PII (no blocking)
agent = Agent(
model="claude-sonnet-4-20250514",
tool_permission_callback=TealTigerPermissionCallback(),
)
# With governance policies
from tealtiger import TealEngine
engine = TealEngine(policies=company_policies, mode="ENFORCE")
agent = Agent(
model="claude-sonnet-4-20250514",
tool_permission_callback=TealTigerPermissionCallback(engine=engine),
)
Capabilities
- Integrates with existing
tool_permission_callbackinterface - Pre-tool-call policy evaluation (<5ms, deterministic, no LLM in governance path)
- Tool allowlisting (block tools not in approved list)
- Cost tracking per session with budget enforcement
- PII detection in tool arguments
- Structured audit trail with correlation IDs
- Kill switch to halt execution
- Zero-config mode: always returns True (allow) but records everything for later analysis
- Policy mode: returns True/False based on deterministic policy evaluation
Why Claude Agent SDK specifically
The tool_permission_callback is already the right hook point. This integration fills it with a production-ready governance engine instead of requiring users to write custom permission logic for each deployment.
It also provides the "observe first" adoption path: start with TealTigerPermissionCallback() that allows everything but tracks cost and detects PII, then later switch to TealTigerPermissionCallback(engine=engine) when policies are ready.
Context
- TealTiger — open-source AI agent security platform (Apache-2.0, NVIDIA Inception)
- Published on PyPI (
tealtigerv1.3.0) and npm (tealtiger-ai-sdkv0.1.0) - Covers 8/10 OWASP Agentic Security Index categories
- All governance is deterministic and in-process — no external service, <5ms overhead
- Already integrated with LangChain, Vercel AI SDK, CrewAI, LlamaIndex, AG2, Haystack, Pydantic AI, Mastra, Semantic Kernel
Contribution plan
Happy to contribute:
- A standalone
claude-tealtigerpip package implementingtool_permission_callback - A cookbook entry in
anthropics/claude-cookbooksshowing the integration - Documentation showing zero-config → policy-driven adoption path
References
- https://github.com/agentguard-ai/tealtiger — TealTiger source (Apache-2.0)
- https://pypi.org/project/tealtiger/ — TealTiger on PyPI (v1.3.0)
- https://www.npmjs.com/package/tealtiger-ai-sdk — Vercel AI SDK middleware (v0.1.0)
- https://owasp.org/www-project-top-10-for-large-language-model-applications/ — OWASP ASI
- Existing
tool_permission_callbackexample in this repo
This fits the right layer of the SDK, especially because tool_permission_callback already sits before execution.
One thing I would keep explicit in the callback result is the difference between policy evaluation and execution authority. A useful return shape would carry more than allow/deny:
- decision:
allow,deny, orapproval_required - policy id/version and evaluation reason
- actor/session/tool/resource/scope bindings
- canonical args digest for the exact proposed call
- expiry or freshness window for the decision
- optional budget/circuit-breaker state
- audit/event ref that the post-tool result can link back to
That keeps observe-first mode, automated policy, and human approval on the same contract without making the model or the tool implementation infer what was authorized. The regression I would want is: same tool with changed args, scope, or budget state must require a new decision rather than reusing the prior callback result.