Skip to main content

Policy Template Guide

The TealTiger Playground ships with 15 enterprise-ready policy templates organized into six categories. Each template is fully customizable — adjust parameters, preview the generated code, and save to your workspace.

Quick Start

  1. Open the Template Library from the sidebar
  2. Pick a template by category or search by name
  3. Click the template card to open the Template Customizer
  4. Adjust parameters using the form inputs
  5. Preview the generated code
  6. Click “Save to Workspace” to create a policy from the template

Template Categories

CategoryCountPurpose
Security4Protect against attacks and data leaks
Cost Control3Manage budgets, rates, and token usage
Reliability3Handle failures, retries, and fallbacks
Compliance2Audit logging and data residency
Routing1Multi-provider request routing
Performance2Caching and load balancing

Security Templates

1. PII Detection and Redaction

Detects PII in requests and responses, then blocks, redacts, or monitors.
ParameterDefaultDescription
actionREDACTDENY, REDACT, or MONITOR
piiTypesall 5 typesemail, phone, SSN, credit card, address
redactionChar*Character used for redaction
Compliance: GDPR Article 32, OWASP ASI02, SOC2 CC6.1

2. Content Moderation

Filters harmful content using toxicity scoring. Categories: hate speech, violence, sexual content, self-harm, harassment.
ParameterDefaultDescription
categories4 categoriesContent categories to filter
toxicityThreshold0.7Score threshold (0–1)
actionDENYDENY, MONITOR, or SANITIZE

3. Prompt Injection Detection

Detects jailbreaks, role-playing exploits, instruction overrides, delimiter attacks, and encoding attacks.
ParameterDefaultDescription
sensitivitymediumlow, medium, or high
blockJailbreakstrueBlock jailbreak attempts
blockRolePlaytrueBlock role-playing exploits

4. RBAC Enforcement

Restricts AI model and feature access based on user roles with permission inheritance.
ParameterDefaultDescription
roleHierarchyadmin → editor → viewerRole inheritance tree
modelPermissionsper-role model listsModels allowed per role
strictModetrueDeny unknown roles

Cost Control Templates

5. Budget Enforcement

Per-request, daily, and monthly budget limits.
ParameterDefaultRange
perRequestLimit$0.100.0010.001–100
dailyBudget$10.000.010.01–10,000
monthlyBudget$100.000.010.01–100,000

6. Rate Limiting

Sliding window rate limiting per user or API key.
ParameterDefaultRange
requestsPerMinute101–1,000
requestsPerHour1001–10,000
burstAllowance50–100

7. Token Optimization

Caps input/output tokens with optional prompt compression.
ParameterDefaultRange
maxInputTokens2,000100–100,000
maxOutputTokens1,00050–100,000
compressionEnabledtrue

Reliability Templates

8. Circuit Breaker

Prevents cascading failures. States: CLOSED → OPEN → HALF_OPEN → CLOSED.
ParameterDefaultDescription
failureThreshold5Failures before opening
timeout60,000msTime before half-open test
halfOpenRequests3Test requests in half-open

9. Retry Strategy

Exponential backoff with jitter for transient failures.
ParameterDefaultDescription
maxRetries3Maximum retry attempts
initialDelay1,000msFirst retry delay
maxDelay30,000msMaximum delay cap

10. Model Fallback

Automatically switches to alternative models on failure.
ParameterDefaultDescription
fallbackChainGPT-4 → GPT-3.5 → ClaudeOrdered model list
maxRetries3Retries per model
fallbackOnRateLimittrueFallback on rate limits

Compliance Templates

11. Audit Logging

Tamper-proof audit logs with PII redaction. Log levels: minimal, standard, detailed.

12. Data Residency

Geographic restrictions on data processing. Supports 10 regions.

Routing & Performance Templates

13. Multi-Provider Routing

Routes across providers using cost-optimized, latency-optimized, round-robin, or weighted strategies.

14. Semantic Cache

Caches responses for semantically similar queries. Configurable similarity threshold and TTL.

15. Load Balancing

Distributes requests using round-robin, least-connections, weighted, or random algorithms.

Combining Templates

CombinationTemplatesPurpose
Security stackPII + Content Moderation + Prompt InjectionFull input/output protection
Cost managementBudget + Rate Limiting + Token OptimizationLayered cost control
High availabilityCircuit Breaker + Retry + Model FallbackResilient AI pipeline
Compliance bundleAudit Logging + Data Residency + RBACRegulatory compliance
PerformanceSemantic Cache + Load Balancing + Multi-ProviderOptimized throughput
Create each template as a separate policy, then configure your evaluation pipeline to run them in sequence. Security policies should run first, followed by routing, then cost controls.