Enable Security • AI Agents Framework

enable_security: Enable all security features in one call.

enable_security

Function

</div>

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

python
def enable_security(log_path: Optional[str], include_output: bool, extra_patterns: Optional[List[str]]) -> dict

Parameters

ParamField Optional[str]

Audit log path (default: ~/.praisonai/audit.jsonl).

ParamField bool

Include tool output in audit entries.

ParamField Optional

Extra injection detection patterns.

Returns

ResponseField dict

&#123;”injection”: str, “audit”: str&#125;

Usage

python
>>> from praisonai.security import enable_security
    >>> enable_security()

    Then use Agent normally — no extra parameters needed:
    >>> from praisonaiagents import Agent
    >>> agent = Agent(instructions="You are a researcher")
    >>> agent.start("Research AI news")

Uses

  • enable_injection_defense
  • enable_audit_log

Source

View on GitHub

praisonai/security/__init__.py at line 172