Skip to main content
TealEngine is the core policy evaluation engine that provides mode-based enforcement with the deterministic Decision contract.

Overview

TealEngine evaluates requests against configured policies and returns Decision objects with:
  • Mode-specific behavior (ENFORCE, MONITOR, REPORT_ONLY)
  • Risk scoring for security analysis
  • Reason codes for explainability
  • Correlation IDs for traceability

Class

Configuration

Creating an Engine

Basic Configuration

Environment-Specific Modes

Policy-Specific Modes

Evaluating Requests

Basic Evaluation

With Metadata

Policy Modes

ENFORCE Mode

MONITOR Mode

REPORT_ONLY Mode

Mode Resolution

Mode resolution follows this priority:
  1. Policy-specific override (highest priority)
  2. Environment-specific override
  3. Global default (lowest priority)

Caching

Integration with TealAudit

Error Handling

Async Support

Performance

TealEngine targets:
  • < 10ms per evaluation (p99, without external calls)
  • < 50ms with caching (p99, cache hit)
  • Deterministic results (same inputs → same outputs)

Best Practices

Always Provide Context

Use Appropriate Modes

Handle Denials Gracefully

Type Hints