SecurityPolicy is passed to Create() via the WithSecurity option. It composes PII detection, injection defense, toxicity / code-security / invisible-text scanners, network policy, transformation rules, audit logging, and environment variable security into a single struct.
SecurityPolicy
Methods
PIIConfig
Configure detection and handling of personally identifiable information in outbound HTTP traffic.PIIType constants
RedactionAction constants
InjectionDefenseConfig
Detect and block prompt injection attempts in outbound HTTP request bodies.ToxicityConfig
Scan outbound HTTP request bodies for toxic content.CodeSecurityConfig
Detect suspicious code in outbound HTTP request bodies.InvisibleTextConfig
Detect invisible or control Unicode characters in outbound HTTP request bodies.CustomPolicyConfig
Attach OPA/Rego policy — a built-in governance pack viaPolicyRef, or your
own rules via InlineRego/InlineModules. Custom rules are evaluated at the
enforcement layer alongside the platform defaults and can only tighten policy,
never relax it.
See Custom Policy and
Governance Packs for the full guides.
ContentGateConfig
Run thecontent.scan OPA gate (e.g. an LLM model allowlist / cross-signal
rules) on the listed domains. Opts a sandbox into content-gate enforcement
without requiring an ML scanner to be enabled.
See Custom Policy for details.