Skip to content

Pydantic AI

Guard a Pydantic AI tool function with a decorator. When Kaizen blocks, the function does not run and returns a refusal.

from kaizen_security import Kaizen
from kaizen_security.integrations.pydantic_ai import guard

kz = Kaizen(api_key="kz_live_...", agent="pydantic-agent")

@agent.tool_plain
@guard(kz)
def lookup(q: str) -> str:
    ...

Pass tool="name" to guard to set the name Kaizen reports for the tool.

Install:

pip install kaizen-security pydantic-ai