Recipes
Guard customer data
For an agent that exports records, in 15 frameworks.
Last reviewed 2026-10-02
An export that includes social security numbers is refused; other fields export. On a list, contains means one of the items equals the value.
The rule
{
"name": "customer-data-guard",
"effect": "deny",
"priority": 10,
"match_path": "/tools/export_customers",
"conditions": [
{
"field": "fields",
"op": "contains",
"value": "ssn"
}
]
}Measured on production (2026-10-02, rule tester): the risky call below matches this rule and the safe one does not.
| Risky | {"segment": "all", "fields": ["email", "ssn"]} |
|---|---|
| Safe | {"segment": "all", "fields": ["email", "plan"]} |
Pick your framework
| Framework | Tool name CAIN sees | Plugs into |
|---|---|---|
| Python (any function) | export_customers | the function that acts |
| LangChain | export_customers | your agent's tool list |
| LangGraph | export_customers | the tools your graph's nodes call |
| OpenAI Agents SDK | export_customers | function tools |
| CrewAI | export_customers | CrewAI's before-tool-call hooks |
| LlamaIndex | export_customers | FunctionTool |
| Pydantic AI | export_customers | an agent capability |
| AutoGen (agentchat) | export_customers | the callables you give AssistantAgent |
| Google ADK | export_customers | the functions in an agent's tools |
| Claude Agent SDK | mcp__ops__export_customers | PreToolUse hooks |
| MCP client (Python) | export_customers | any MCP client session |
| OpenTelemetry | export_customers | your existing tracing |
| Any other framework | export_customers | any Python callable |
| TypeScript / JavaScript | export_customers | any async function |
| HTTP (any language) | export_customers | your own call site |
Try CAIN-42 on your own agents
Create a free account and every new account starts with a 7-day trial of the full platform. Or try the sandbox first, with no account at all.
Create a free account → · Try the sandbox · See the whole ecosystem