Wrap `send_refund`, `issue_payout`, or any tool that moves money — the inner tool only fires on an approve verdict.
For: Agent builders whose tool calls move money or write to a ledger
Auto-approves refunds under the escalation threshold for customers in good standing; escalates above it.
Blocks any refund tied to an active chargeback, regardless of amount.
Restrains a payout when the same claim reference has already been settled.
# LangChain Money-Moving Tool Gate
# Fork: thresholds mirror the "Refunds" governance template — change them.
# Wrap the tool with DecionisGateTool.wrap(shadow_mode=True) first.
apiVersion: decionis.dev/v1
kind: PolicyPack
metadata:
name: langchain-money-moving-tool-gate
surface: langchain
workflow_key: refund_execution
standards: [SOC2-CC7.2, ISO27001-A.8.9]
defaults:
mode: shadow
emit_dossier: true
rules:
- name: refund_ceiling
when: "tool == 'send_refund'"
decision: |
ALLOW IF refund_amount < 1000 AND customer.standing == 'good'
ESCALATE IF refund_amount < 10000
BLOCK OTHERWISE
reason_code: refund_over_threshold
- name: active_chargeback_block
when: "tool == 'send_refund'"
decision: |
BLOCK IF chargeback == true
ALLOW OTHERWISE
reason_code: refund_on_active_chargeback
- name: duplicate_claim_guard
when: "tool in ['send_refund', 'issue_payout']"
decision: |
RESTRAIN IF claim.reference in ledger.settled_references
ALLOW OTHERWISE
reason_code: duplicate_claim_reference
Fork it, change the thresholds to match your environment, and deploy in shadow mode first — it defaults to listen-only so nothing in your live pipeline changes.
Wraps any LangChain BaseTool. The LLM still picks the tool on the same prompt; Decionis decides if the call fires.
# pip install decionis-langchain
from decionis import DecionisClient
from decionis_langchain import DecionisGateTool
client = DecionisClient(api_key="...", base_url="https://api.decionis.com")
gated_refund = DecionisGateTool.wrap(
inner_tool=send_refund,
client=client,
tenant_id="org-uuid",
workflow_key="refund_execution",
shadow_mode=True, # ← every verdict recorded; inner tool always runs
site_base_url="https://decionis.com",
)
agent.bind_tools([gated_refund])
Ships in shadow mode — every verdict is recorded, nothing is blocked.
This recipe is one step in a path. The same five steps apply to every recipe in the exchange.
Run the policy against a realistic action in the browser. Push it past what the rules allow and watch the verdict come back. No account.
See exactly what was decided and why: the rule that fired, the evidence it read, the policy version in force, and an Ed25519 signature you can verify yourself.
Measure what the policy would have caught on your own traffic without touching the live path. Every recipe defaults to shadow, so the first deployment carries no execution risk.
Point the same policy at the system where the action actually originates — a checkout, an ERP posting, a Zap, an agent's tool call.
Publish the proof: a public verification link, an embeddable badge, a PR comment, or an anonymized shadow-mode finding. This is how the next person discovers Decionis.