TealTiger Integration
Persistent governance state for LLM applications. TealTiger's guardrails, cost tracking, and policy decisions backed by Dakera — every DENY, ALLOW, and cost event decay-weighted and semantically recalled across sessions.
pip install dakera[tealtiger] (Python) · npm install @dakera-ai/dakera (JavaScript, built-in) · GitHub →Quick Start
Run Dakera
Dakera is a self-hosted memory server. Spin it up with Docker:
docker run -d \
--name dakera \
-p 3300:3300 \
-e DAKERA_ROOT_API_KEY=dk-mykey \
ghcr.io/dakera-ai/dakera:latest
# Verify it's running
curl http://localhost:3300/health
For production with persistent storage, use Docker Compose.
Install
# Python — TealTiger extra
pip install "dakera[tealtiger]"
# JavaScript — built into the main SDK (v0.11.94+)
npm install @dakera-ai/dakera
Requirements: Python ≥ 3.10, Node.js ≥ 20, a running Dakera server (v0.11.94+).
Connect TealTiger to Dakera
from dakera.integrations.tealtiger import (
DakeraCostStorage,
DakeraDecisionStore,
DakeraDelegationHelper,
)
# Cost tracking — persist LLM spend against Dakera agent memory
cost_store = DakeraCostStorage(
api_url="http://localhost:3300",
api_key="dk-mykey",
agent_id="my-agent",
)
# Governance decisions — DENY/ALLOW stored with decay-weighted importance
decision_store = DakeraDecisionStore(
api_url="http://localhost:3300",
api_key="dk-mykey",
agent_id="my-agent",
)
# Delegation chains — write KG edges for audit trails
delegation = DakeraDelegationHelper(
api_url="http://localhost:3300",
api_key="dk-mykey",
agent_id="my-agent",
)
DakeraCostStorage
Persist LLM cost events as decay-weighted Dakera memories. Cost records are linked to the agent session that incurred them, enabling cross-session spend analysis and budget-aware recall.
Python
from dakera.integrations.tealtiger import DakeraCostStorage
cost_store = DakeraCostStorage(
api_url="http://localhost:3300",
api_key="dk-mykey",
agent_id="billing-agent",
)
# Record a cost event
cost_store.record(
model="gpt-4o",
input_tokens=1200,
output_tokens=340,
cost_usd=0.0142,
session_id="sess_abc123",
tags=["research", "production"],
)
# Retrieve cost history for a session
history = cost_store.session_costs(session_id="sess_abc123")
print(f"Total spend: ${history.total_usd:.4f}")
# Semantic recall — "what did the research pipeline cost last week?"
recent = cost_store.recall(query="research pipeline cost", top_k=5)
for event in recent:
print(event.model, event.cost_usd)
JavaScript / TypeScript
import { DakeraCostStorage } from '@dakera-ai/dakera/tealtiger'
const costStore = new DakeraCostStorage({
apiUrl: 'http://localhost:3300',
apiKey: 'dk-mykey',
agentId: 'billing-agent',
})
// Record a cost event
await costStore.record({
model: 'gpt-4o',
inputTokens: 1200,
outputTokens: 340,
costUsd: 0.0142,
sessionId: 'sess_abc123',
tags: ['research', 'production'],
})
// Semantic recall
const recent = await costStore.recall({ query: 'research pipeline cost', topK: 5 })
console.log(recent)
DakeraCostStorage options
| Parameter | Type | Default | Description |
|---|---|---|---|
api_url | str | — | Dakera server URL |
api_key | str | "" | Dakera API key |
agent_id | str | — | Agent identifier for memory namespacing |
importance | float | 0.6 | Base importance for cost memories (decay applies) |
ttl_seconds | int | None | Auto-expire cost records after N seconds |
memory_type | str | "episodic" | Dakera memory type for cost events |
DakeraDecisionStore
Store TealTiger governance decisions (DENY, ALLOW, ESCALATE) as semantically recalled Dakera memories. Policy decisions are stored with importance weights that reflect their severity — DENY decisions decay slowly, ensuring audit trails remain accessible.
Python
from dakera.integrations.tealtiger import DakeraDecisionStore
decision_store = DakeraDecisionStore(
api_url="http://localhost:3300",
api_key="dk-mykey",
agent_id="policy-agent",
)
# Record a DENY decision — stored at importance 0.95
decision_store.record(
decision="DENY",
policy_id="no-pii-exfiltration",
reason="Request contained SSN pattern",
context={"input_hash": "a3f1...", "user_id": "u_42"},
)
# Record an ALLOW decision — stored at importance 0.80
decision_store.record(
decision="ALLOW",
policy_id="read-public-docs",
reason="Request matched allowlisted scope",
)
# Recall recent DENY decisions for a policy
denials = decision_store.recall(
query="PII exfiltration denial",
decision_filter="DENY",
top_k=10,
)
# Audit log — all decisions for an agent
audit = decision_store.audit_log(agent_id="policy-agent", limit=100)
JavaScript / TypeScript
import { DakeraDecisionStore } from '@dakera-ai/dakera/tealtiger'
const decisions = new DakeraDecisionStore({
apiUrl: 'http://localhost:3300',
apiKey: 'dk-mykey',
agentId: 'policy-agent',
})
await decisions.record({
decision: 'DENY',
policyId: 'no-pii-exfiltration',
reason: 'Request contained SSN pattern',
context: { inputHash: 'a3f1...', userId: 'u_42' },
})
const denials = await decisions.recall({
query: 'PII exfiltration denial',
decisionFilter: 'DENY',
topK: 10,
})
Importance weighting by decision severity
Governance decisions are stored with importance weights that reflect their policy severity. Higher-importance memories decay more slowly, keeping critical audit events accessible longer.
| Decision | Importance | Decay behaviour |
|---|---|---|
DENY | 0.95 | Very slow decay — audit trails persist for weeks |
ESCALATE | 0.90 | Slow decay — escalation context stays accessible |
ALLOW | 0.80 | Standard decay — routine approvals fade normally |
OBSERVE | 0.65 | Faster decay — observation signals expire quickly |
importance=0.99 to record() for high-severity incidents you want to retain indefinitely.DakeraDelegationHelper
Write knowledge graph edges for agent delegation chains. Each delegation link is stored as a directed edge in Dakera's KG — enabling traversal and audit of multi-agent permission chains.
Python
from dakera.integrations.tealtiger import DakeraDelegationHelper
delegation = DakeraDelegationHelper(
api_url="http://localhost:3300",
api_key="dk-mykey",
agent_id="orchestrator",
)
# Record that orchestrator delegated to researcher with limited scope
delegation.delegate(
from_agent="orchestrator",
to_agent="researcher",
scope=["read:web", "write:notes"],
session_id="sess_abc123",
)
# Traverse the full delegation chain for a session
chain = delegation.get_chain(session_id="sess_abc123")
for edge in chain.edges:
print(f"{edge.from_agent} → {edge.to_agent} [{', '.join(edge.scope)}]")
# Check if a delegation path exists between two agents
can_delegate = delegation.path_exists(
from_agent="orchestrator",
to_agent="executor",
)
JavaScript / TypeScript
import { DakeraDelegationHelper } from '@dakera-ai/dakera/tealtiger'
const delegation = new DakeraDelegationHelper({
apiUrl: 'http://localhost:3300',
apiKey: 'dk-mykey',
agentId: 'orchestrator',
})
await delegation.delegate({
fromAgent: 'orchestrator',
toAgent: 'researcher',
scope: ['read:web', 'write:notes'],
sessionId: 'sess_abc123',
})
const chain = await delegation.getChain({ sessionId: 'sess_abc123' })
console.log(chain.edges)
Full example — governed agent pipeline
Wire all three classes together for a complete governance setup: cost tracking, policy decisions, and delegation audit — all stored in Dakera.
import os
from dakera.integrations.tealtiger import (
DakeraCostStorage,
DakeraDecisionStore,
DakeraDelegationHelper,
)
DAKERA_URL = os.environ["DAKERA_URL"]
DAKERA_KEY = os.environ["DAKERA_API_KEY"]
# Set up governance stores
costs = DakeraCostStorage(api_url=DAKERA_URL, api_key=DAKERA_KEY, agent_id="orchestrator")
decisions = DakeraDecisionStore(api_url=DAKERA_URL, api_key=DAKERA_KEY, agent_id="orchestrator")
delegation = DakeraDelegationHelper(api_url=DAKERA_URL, api_key=DAKERA_KEY, agent_id="orchestrator")
def run_governed_task(task: str, session_id: str):
# 1. Delegate to a sub-agent (writes KG edge)
delegation.delegate(
from_agent="orchestrator",
to_agent="worker",
scope=["read:web"],
session_id=session_id,
)
# 2. TealTiger guardrail check
verdict = tealtiger_check(task)
if verdict == "DENY":
decisions.record(
decision="DENY",
policy_id="content-policy",
reason="Task failed safety guardrails",
context={"task": task[:80]},
)
return None
decisions.record(
decision="ALLOW",
policy_id="content-policy",
reason="Task passed safety guardrails",
)
# 3. Execute and record cost
result, token_usage = execute_task(task)
costs.record(
model="gpt-4o",
input_tokens=token_usage.input,
output_tokens=token_usage.output,
cost_usd=token_usage.cost,
session_id=session_id,
)
return result
Using environment variables
import os
from dakera.integrations.tealtiger import DakeraDecisionStore
decisions = DakeraDecisionStore(
api_url=os.environ["DAKERA_URL"],
api_key=os.environ["DAKERA_API_KEY"],
agent_id="my-agent",
)
Related integrations
Links
- GitHub — tealtiger-python-prod
- TealTiger documentation
- TealTiger homepage
- Dakera deploy — Docker Compose setup
- Dakera full documentation
- All integrations
Frequently Asked Questions
What is TealTiger?
TealTiger is an AI agent security platform that provides guardrails, cost tracking, and policy management for LLM applications. It intercepts agent actions, evaluates them against policies, and returns DENY/ALLOW/ESCALATE decisions in real time.
How does Dakera extend TealTiger?
Dakera adds persistent, semantically-recalled storage to TealTiger's governance state. Policy decisions, cost events, and delegation chains are stored as decay-weighted memories — so your agent can recall past denials, audit spend over time, and traverse delegation chains across sessions without rebuilding state from scratch.
What is the difference between DakeraCostStorage and DakeraDecisionStore?
DakeraCostStorage records token-level LLM spend and supports spend-aware semantic recall. DakeraDecisionStore stores policy decisions (DENY/ALLOW/ESCALATE) at importance weights matched to their severity — DENY at 0.95, ALLOW at 0.80 — so critical audit events persist longer through Dakera's decay engine.
Does TealTiger require a Dakera API key?
Yes. Both the Python package (dakera[tealtiger]) and the JavaScript SDK (@dakera-ai/dakera) connect to your self-hosted Dakera server and require a DAKERA_API_KEY. Dakera runs fully on-premises — no data leaves your infrastructure.