LangChain / LangGraph
Attach Kaizen to any LangChain or LangGraph agent.
pip install "kaizen-security[langchain]"
Observe
Pass the callback handler. Every tool the agent calls is reported, so the Observer learns the agent's behavior and flags deviations.
from kaizen_security import Kaizen
from kaizen_security.integrations.langchain import KaizenCallbackHandler
kz = Kaizen(api_key="kz_live_...", agent="support-bot")
agent.invoke({"input": "..."}, config={"callbacks": [KaizenCallbackHandler(kz)]})
Block
LangChain swallows exceptions raised inside callbacks, so the callback is observe-only. To block a tool, wrap it. A blocked call returns a refusal to the agent instead of running.
from kaizen_security.integrations.langchain import guard_tool
safe_tools = [guard_tool(kz, t) for t in tools]