Skip to main content

enable_security

Function
This function is defined in the security module.
Enable all security features in one call. Activates both injection defense and audit logging globally. .. warning:: These hooks register on the process-global praisonaiagents.hooks registry and apply to every Agent in the process. This one-liner is not tenant-scoped: in a multi-tenant host (e.g. praisonai serve) one tenant’s extra_patterns would apply to all tenants. Keep the returned hook IDs and remove them via praisonaiagents.hooks.remove_hook to disable per feature.

Signature

Parameters

Optional[str]
Audit log path (default: ~/.praisonai/audit.jsonl).
bool
default:"False"
Include tool output in audit entries.
Optional
Extra injection detection patterns.

Returns

dict
{“injection”: str, “audit”: str}

Usage

Uses

  • enable_injection_defense
  • enable_audit_log

Source

View on GitHub

praisonai/security/__init__.py at line 172