Cookbook
How to add human approval to any AI tool call
When governance blocks a tool call, Cadreen returns a conversational prompt instead of executing. No custom approval UI needed — the AI asks, the human answers.
1
How the approval flow works
The model proposes a tool call. Cadreen checks it against your rules. If a rule requires approval, Cadreen returns a conversational prompt instead of executing the tool.
2
What the user sees
In opencode, Cursor, or any chat surface, the held action shows up as a message. The response also lists it in pending_actions:
> Refund $500 to customer 12345
This action needs a person's approval before it can run:
- process_refund (decision governance_task:7c1e2a40-...)
A person in this workspace has to approve or decline it, signed in. Replying here does not approve it.Typing "yes" in the chat does not approve anything. A signed-in member of the workspace approves or declines it in the decision inbox, or with POST /api/v1/cadreen/decisions/{decision_id}/resolve. An API key can't decide. Approving runs the refund once, with the arguments the model proposed.
3
Handle approvals in your code
When you call the API, the response tells you if approval is needed.
4
Under the hood: the approval token
When a human approves, Cadreen issues an HMAC-SHA256 signed approval token. It's scoped to the exact action, parameters, tenant, and execution. It expires in 1 hour. It can be revoked.
{
"token_id": "tok_abc123",
"mission_id": "mis_xyz",
"workspace_id": "ws_123",
"action": "process_refund",
"parameters": {"amount": 500, "customer_id": "12345"},
"approved_by": "user:456",
"approved_at": "2026-06-21T10:30:00Z",
"expires_at": "2026-06-21T11:30:00Z",
"signature": "a1b2c3d4..." // HMAC-SHA256
}Every token is cryptographically verified — signature, expiration, revocation, scope, action, and rule version are all checked before approval is accepted.
Next: Recovering from tool failures — diagnosis, retries and precedent memory.