← Back to blog
Use CasesShopify10 min read

September 12, 2026

Shadow-evaluate Shopify mutations before enforcement

A false allow repeats an unauthorized refund batch. A false deny damages support. Validate decision accuracy on live refund, discount, and inventory intents before cutover.

Shadow evaluate, then move the token

ShopifyActionFirewall defaults to dryRun: true. Evaluate still runs and writes audit. executed stays false even on allow, so the firewall does not proxy to Shopify.

Do not cut the token over first. For one week, keep the existing support path executing mutations while the agent also calls the firewall with dryRun: true. Customer outcomes do not change. Audit fills with what policy would have done.

import { ShopifyActionFirewall } from "@limetry/shopify"

const firewall = new ShopifyActionFirewall({
  shopDomain: "acme.myshopify.com",
  adminToken: process.env.SHOPIFY_ADMIN_TOKEN!,
  apiKey: process.env.LIMETRY_API_KEY!,
  baseUrl: process.env.LIMETRY_BASE_URL,
  policyId: process.env.LIMETRY_SHOPIFY_POLICY_ID!,
  dryRun: true,
})

const result = await firewall.createRefund({
  orderId: "5839201741",
  amountMinor: 8800,
  currency: "USD",
})

process.stdout.write(JSON.stringify({
  action_type: result.intent.action_type,
  amount_minor: result.intent.cost?.amount_minor,
  decision: result.evaluation.decision,
  dry_run: result.dryRun,
  executed: result.executed,
  decision_id: result.evaluation.decision_id,
}, null, 2))

Review every denied or parked refund with support leads. Tune policy (action type, amount threshold, inventory deny) — not the prompt.

Confirm accuracy before cutover

Example dry-run week:

shopify.refund under $25:        126 allow
shopify.refund $25 and higher:    18 approval_required
shopify.inventory:                 3 deny
false denies:                      0
true deny examples:                3 attempted inventory wipes
median evaluate latency:        168 ms

Zero false denies on refunds, parked amounts the leads agree should wait, and inventory attempts that should never live in a support agent are the cutover signal.

Enable enforcement

Set dryRun to false and remove the parallel Shopify client. Keep the Admin token only in the firewall. Park higher refunds as approval_required for operator approval via the approval API.

Related: Stop a fourteen-refund batch before Shopify settles. Origin: Gate Shopify Admin mutations for AI support agents.

Run Limetry on your own stack

Self-host the open source evaluation server, wire evaluate into your agents, and keep privacy-safe audit under your control.