Deterministic governance middleware for Composio tool calls — policy enforcement, PII detection, cost tracking, and audit evidence.
Project description
composio-tealtiger
Deterministic governance middleware for Composio tool calls — policy enforcement, PII detection, cost tracking, and structured audit evidence using TealTiger.
No LLM in the governance path. All policy evaluation is deterministic, adding <5ms latency.
Installation
pip install composio-tealtiger
Quick Start
Zero-Config (Observe Mode)
Add governance to any Composio tool call with zero configuration. TealTiger observes all traffic, tracks costs, detects PII, and allows everything through — producing structured audit entries.
from composio import Composio
from composio_tealtiger import governance_modifiers
composio = Composio()
# Get tools with TealTiger governance (observe mode — zero config)
tools = composio.tools.get(
user_id="user_123",
toolkits=["github", "slack"],
**governance_modifiers()
)
# Every tool call is now tracked: cost, PII detection, audit trail
# Nothing is blocked in observe mode — just visibility
Enforce Mode (Policy Enforcement)
from composio import Composio
from composio_tealtiger import governance_modifiers
from tealtiger import TealEngine
# Define governance policies
engine = TealEngine(policies=[
{"type": "tool_allowlist", "agent": "coder", "allowed": ["GITHUB_*", "HACKERNEWS_*"]},
{"type": "pii_block", "categories": ["ssn", "credit_card"]},
{"type": "cost_limit", "max_per_session": 5.00},
])
composio = Composio()
# Get tools with enforcing governance
tools = composio.tools.get(
user_id="user_123",
toolkits=["github", "gmail", "slack"],
**governance_modifiers(engine=engine, mode="ENFORCE")
)
# Agent can use GITHUB_* tools → ALLOWED
# Agent tries GMAIL_SEND_EMAIL → DENIED (not in allowlist)
# Agent passes SSN in tool args → DENIED (PII blocked)
# Agent exceeds $5 budget → DENIED (cost limit)
With Kill Switch
from tealtiger import freeze, unfreeze
# Emergency: stop all tool execution for an agent
freeze("coder-agent")
# After investigation, restore access
unfreeze("coder-agent")
How It Works
composio-tealtiger uses Composio's native modifier hooks:
beforeExecute— Evaluates governance policies before any tool executes. If the policy denies the action, execution is blocked before reaching the external service.afterExecute— Records the execution result in the audit trail and updates cost tracking.modifySchema— Optionally adds governance metadata (allowed/denied status) to tool schemas for AI context.
Agent → Composio → beforeExecute (TealTiger evaluates) → Tool Execution → afterExecute (audit)
↓ (if DENY)
GovernanceDenyError (tool never executes)
Features
| Feature | Observe | Enforce |
|---|---|---|
| PII detection (email, SSN, credit card, phone) | ✅ report | ✅ block |
| Tool allowlisting per agent/role | — | ✅ |
| Cost tracking per tool call | ✅ | ✅ |
| Per-session budget limits | — | ✅ |
| Structured audit trail | ✅ | ✅ |
| Correlation IDs (UUID v4) | ✅ | ✅ |
| Kill switch (freeze/unfreeze) | ✅ | ✅ |
| Risk scoring | ✅ | ✅ |
API Reference
governance_modifiers(engine=None, mode="OBSERVE", agent_id=None)
Returns a dict of Composio modifier hooks configured for TealTiger governance.
Parameters:
engine(TealEngine, optional) — Policy engine. If None, uses observe mode.mode(str) —"OBSERVE","MONITOR", or"ENFORCE". Default:"OBSERVE".agent_id(str, optional) — Agent identifier. Auto-generated if not provided.
Returns: Dict with beforeExecute, afterExecute, and optionally modifySchema keys.
GovernanceDenyError
Raised when a tool call is denied in ENFORCE mode.
from composio_tealtiger import GovernanceDenyError
try:
result = composio.tools.execute("GMAIL_SEND_EMAIL", params, **governance_modifiers(engine=engine, mode="ENFORCE"))
except GovernanceDenyError as e:
print(f"Blocked: {e.decision['reason']}")
print(f"Codes: {e.decision['reason_codes']}")
Audit Trail
Every governance evaluation produces a structured audit entry:
{
"correlation_id": "550e8400-e29b-41d4-a716-446655440000",
"timestamp_ms": 1720000000000,
"action": "DENY",
"mode": "ENFORCE",
"tool_slug": "GMAIL_SEND_EMAIL",
"toolkit_slug": "gmail",
"agent_id": "coder-agent",
"reason": "Tool not in allowlist for role 'coder'",
"reason_codes": ["TOOL_NOT_ALLOWED"],
"pii_detected": [],
"cost_tracked": 0.0,
"evaluation_time_ms": 0.42
}
Requirements
- Python 3.9+
composio>= 0.7.0tealtiger>= 1.1.0
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file composio_tealtiger-0.1.0.tar.gz.
File metadata
- Download URL: composio_tealtiger-0.1.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c1e0e7d408f87ec060c419e8ef72568337887083b4ee67119ee5ad8cc23cfd5
|
|
| MD5 |
ce16ed51c69b30d9f887268962a157ec
|
|
| BLAKE2b-256 |
dab9ec08a53418b6271d6a970c6139c39034e5d84471f14cf7ea94e15ddc9cbf
|
File details
Details for the file composio_tealtiger-0.1.0-py3-none-any.whl.
File metadata
- Download URL: composio_tealtiger-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fa84f34a329a0eba8d00259dd8a84142a2053ace7cc48e430ab773d5332d7d5
|
|
| MD5 |
05c03a2a8cafad8d54f1edbcc8241ee9
|
|
| BLAKE2b-256 |
a4509028260d698bbffc60011da3e56770ff4444cd800e0ad97437d23bc99750
|