Rules 101
Cadreen evaluates every tool call against your rules before execution. This guide shows how to create rules, evaluate actions, and understand the approval flow.
How governance works
When the model proposes a tool call, Cadreen evaluates it. You don't need to build this. It happens automatically on every request.
Create a rule
/api/v1/cadreen/policiescurl -X POST https://api.cadreen.com/api/v1/cadreen/policies \
-H "Authorization: Bearer sk_cadreen_..." \
-H "Content-Type: application/json" \
-d '{
"name": "Refund Policy",
"applies_to": "tools",
"rules": [
{
"condition": "Require manager approval for refunds over $100",
"effect": "require_human_approval"
},
{
"condition": "Auto-approve refunds of $100 or less",
"effect": "auto_approve"
}
]
}'Rule fields and effects
Evaluate a tool call
Test a rule against an action before it happens in production:
/api/v1/cadreen/policies/evaluatecurl -X POST https://api.cadreen.com/api/v1/cadreen/policies/evaluate \
-H "Authorization: Bearer sk_cadreen_..." \
-H "Content-Type: application/json" \
-d '{
"action": "Refund $250 to an enterprise customer",
"domain": "finance"
}'{
"action": "Refund $250 to an enterprise customer",
"domain": "finance",
"result": {
"type": "handoff",
"confidence": 1,
"reason": "Policy 'Refund Policy' requires human approval: Require manager approval for refunds over $100",
"policy_id": "4f2a9c1e-7b3d-4e8a-9c5f-2d1b6e8a0c34",
"reason_code": "policy_requires_approval"
},
"trace_id": "9b1f0c2e-5d7a-4c3b-8e21-6f4a0d9c7b13"
}A request in the personal domain is checked against the personal rules, such as the one that asks you to confirm a payment. Nothing measured how sure that check was, so confidence is null:
curl -X POST https://api.cadreen.com/api/v1/cadreen/policies/evaluate \
-H "Authorization: Bearer sk_cadreen_..." \
-H "Content-Type: application/json" \
-d '{
"action": "Pay $40 to my landlord",
"domain": "personal"
}'{
"action": "Pay $40 to my landlord",
"domain": "personal",
"result": {
"type": "clarify_requester",
"confidence": null,
"reason": "Policy 'Personal Payments & Transfers' requires human approval: Personal payments or transfers require confirmation before execution.",
"reason_code": "policy_needs_context"
},
"trace_id": "9b1f0c2e-5d7a-4c3b-8e21-6f4a0d9c7b14"
}result.type is auto, auto_complete, handoff, escalate, clarify_requester or abstain. result.confidence is how sure the rule check was, from 0 to 1: a rule that applies is 1, and it is null when the check recorded none, never a number nobody measured. The check reads action and domain only, so describe the amount and the customer in action.The approval flow
When governance holds a tool call, the chat response says so and lists the call in pending_actions:
"content": "This action needs a person's approval before it can run:\n- process_refund (decision governance_task:7c1e2a40-...)\n\nA person in this workspace has to approve or decline it, signed in. Replying here does not approve it.",
"pending_actions": [{
"tool": "process_refund",
"decision_id": "governance_task:7c1e2a40-...",
"resolve_path": "/api/v1/cadreen/decisions/governance_task:7c1e2a40-.../resolve",
"runs_in": "cadreen"
}]Replying "yes" in the chat does not approve it. A person who is signed in to the workspace approves or declines it in the decision inbox, or with POST /api/v1/cadreen/decisions/{id}/resolve. An API key can't decide.
What gets audited
Every governance decision is logged. These appear in intelligence traces and are available for compliance reporting.
How governance works for all tools
Every tool call goes through governance — both Cadreen tools and client tools. The difference is where they run: a Cadreen tool runs on the server, a client tool is returned to you to run. A held client tool waits for a person the same way; once approved, your app fetches a one-time permit and runs it.