Recipes
Guard refunds
For a support agent that issues refunds, in 15 frameworks.
Last reviewed 2026-10-02
Routine refunds stay automatic; large ones are held for a human, with the order and amount in the approval.
The rule
{
"name": "refunds-guard",
"effect": "require_approval",
"priority": 10,
"match_path": "/tools/issue_refund",
"conditions": [
{
"field": "amount_usd",
"op": "gt",
"value": 50
}
]
}Measured on production (2026-10-02, rule tester): the risky call below matches this rule and the safe one does not.
| Risky | {"order_id": "ord_1042", "amount_usd": 480} |
|---|---|
| Safe | {"order_id": "ord_1042", "amount_usd": 12} |
Pick your framework
| Framework | Tool name CAIN sees | Plugs into |
|---|---|---|
| Python (any function) | issue_refund | the function that acts |
| LangChain | issue_refund | your agent's tool list |
| LangGraph | issue_refund | the tools your graph's nodes call |
| OpenAI Agents SDK | issue_refund | function tools |
| CrewAI | issue_refund | CrewAI's before-tool-call hooks |
| LlamaIndex | issue_refund | FunctionTool |
| Pydantic AI | issue_refund | an agent capability |
| AutoGen (agentchat) | issue_refund | the callables you give AssistantAgent |
| Google ADK | issue_refund | the functions in an agent's tools |
| Claude Agent SDK | mcp__ops__issue_refund | PreToolUse hooks |
| MCP client (Python) | issue_refund | any MCP client session |
| OpenTelemetry | issue_refund | your existing tracing |
| Any other framework | issue_refund | any Python callable |
| TypeScript / JavaScript | issue_refund | any async function |
| HTTP (any language) | issue_refund | 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