How It Works
The v1.2 evaluation pipeline follows this sequence:- Resolve — Determine which modules the policy references
- Validate — Confirm all required modules are registered
- Lazy-init — Initialize modules that haven’t been initialized yet
- Dispatch — Run all active modules in parallel (
Promise.allSettled/asyncio.gather) - Handle failures — Apply fail-closed defaults for any module that throws
- Merge — Combine results using “most restrictive action wins”
- Validate — Check the merged Decision against the TEEC registry
ModuleRegistry
TheModuleRegistry manages module lifecycle:
Registration
Modules are registered eagerly at engine construction time. Registration does not callinit().
Lazy Initialization
Modules are initialized on the first evaluation that references them. If a policy doesn’t reference a module’s dimension, that module is never initialized — saving startup time and resources.Dependency Resolution
The registry maps policy keys to module names using a well-known convention:
If a policy references a module that isn’t registered, the engine throws a
TealConfigError before evaluation begins.
Module Status
Query the status of all registered modules at any time:“Most Restrictive Action Wins” Merge
When multiple modules return results, the engine merges them by selecting the most restrictive action. This ensures that if any module flags a concern, the overall decision reflects it.Action Severity Ranking
Merge Example
If three modules return:
The merged result is
DENY_WRITE (severity 100). All reason codes from all modules are combined into the final decision.
Fail-Closed Defaults
If any module throws an exception during evaluation, the engine applies a fail-closed default:- The overall decision becomes
DENY - The reason includes which module(s) failed
- Failed module names appear in
metadata.modules_failed
FAIL_OPEN for non-critical environments:
Granular Failure Policies
You can configure failure behavior for specific scenarios:Writing a Custom Module
Implement theTealModule interface to create your own governance module.
TealModule Interface
Example: Custom Rate Limiter
Register Your Module
ModuleContext
Every module receives aModuleContext with request metadata:
ModuleResult
Every module must return aModuleResult:

