LangChain Integration¶
Installation¶
Usage¶
Wrap individual tools with PolicyShieldTool:
from policyshield.shield.engine import ShieldEngine
from policyshield.integrations.langchain import PolicyShieldTool, shield_all_tools
engine = ShieldEngine(rules="policies/rules.yaml")
# Wrap a single tool
safe_tool = PolicyShieldTool(wrapped_tool=my_tool, engine=engine)
# Or wrap all tools at once
safe_tools = shield_all_tools([tool1, tool2, tool3], engine)
Use with an agent: