Builds an onToolCalled policy hook that checks a proposed refund against a ticket and routes the call to approve, block, or human review before a tool executes.
Original by OpenRouterGuardrailsOpenRouter cookbookSource reviewed
Before you dive in
What you’ll find in the original
Send the proposed call, ticket, and policy together as state.
Choose approve, block, or pause from fixed thresholds in code.
Record the decision and probabilities in an audit log instead of relying on a generated rationale.
Worth knowing
The captured example holds across its repeat calls but shows probability drift; a Jev judgment alone is not an authorization boundary.