Skip to main content

Overview

This guide walks you through creating your first TealTiger policy and observing how it behaves at runtime — with real, runnable code in both TypeScript and Python. By the end you will have a working policy that:
  • Evaluates estimated cost against a budget
  • Considers risk scores
  • Blocks execution when thresholds are exceeded
  • Emits structured audit events with reason codes

Prerequisites


Step 1: Define a Policy

A policy has three parts: conditions (when it applies), actions (what happens), and a mode (observe or enforce).

Step 2: Create the Engine and Evaluate


Step 3: Understand the Decision

Every evaluation produces a Decision object with: Decisions are deterministic — same inputs always produce the same output. No retries, no hidden overrides, no probabilistic behavior.

Step 4: Try Monitor Mode

Change the mode to MONITOR to observe without enforcing:
This lets you safely roll out policies in production before switching to ENFORCE.

Step 5: Inspect Audit Events

Every decision automatically emits a structured audit event:
Audit events are:
  • Redacted by default — prompts and completions are never logged
  • Versioned — schema changes are tracked
  • Correlation-aware — trace decisions across distributed systems

What You Learned

  • Policies evaluate signals deterministically against conditions you define
  • Decisions include reason codes, risk scores, and correlation IDs
  • Monitor mode lets you observe before enforcing
  • Audit events provide defensible evidence without data leakage

Next Steps

Policy Authoring Guide

Build richer policies with complex conditions.

Risk Scores

Tune thresholds for graduated enforcement.

Audit & Telemetry

Export and analyze audit events.

Configuration

Control enforcement, logging, and redaction.