CAIN-42 CAIN Studio

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

FrameworkTool name CAIN seesPlugs into
Python (any function)issue_refundthe function that acts
LangChainissue_refundyour agent's tool list
LangGraphissue_refundthe tools your graph's nodes call
OpenAI Agents SDKissue_refundfunction tools
CrewAIissue_refundCrewAI's before-tool-call hooks
LlamaIndexissue_refundFunctionTool
Pydantic AIissue_refundan agent capability
AutoGen (agentchat)issue_refundthe callables you give AssistantAgent
Google ADKissue_refundthe functions in an agent's tools
Claude Agent SDKmcp__ops__issue_refundPreToolUse hooks
MCP client (Python)issue_refundany MCP client session
OpenTelemetryissue_refundyour existing tracing
Any other frameworkissue_refundany Python callable
TypeScript / JavaScriptissue_refundany async function
HTTP (any language)issue_refundyour 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