Skip to main content

TealGuard v1.4 — Python API

TealGuard v1.4 in Python adds configurable multi-stage defense depth and post-execution response scanning, with the same semantics as the TypeScript SDK.

Constructor

Parameters


depth

Controls how many defense stages execute per request.

guardrails

Configures bi-directional scanning.

Pre-Only (v1.3 Compatible)

Post-Only

Bi-Directional


evaluate()

Evaluates a request through the multi-stage pipeline.

GovernanceDecision

Example


evaluate_response()

Evaluates an LLM response through the post-execution pipeline. New in v1.4.

Example


Short-Circuit Behavior

When a stage produces DENY, subsequent stages are skipped:

Sync and Async Usage

The Python SDK supports both patterns:

Integration with observe()


Backward Compatibility

v1.3 configurations work without changes:
Defaults to depth="fast" with no post-execution scan.

Deep Mode Dependencies

Stage 3 requires ONNX runtime:
The ONNX dependency is only loaded at runtime when depth="deep" is configured. Fast and standard modes have zero additional dependencies.