← Back to all examples

Shopify Support / Ops Agent

@limetry/shopifyTypeScriptrecommendedautomated tests

Built after a support agent batch-refunded $3,200 in two minutes with no approval. Mutation firewall in the runtime (not a Shopify App): allow $10 refunds, deny inventory wipes, approval_required at $25. Admin token stays in the firewall.

Source folder: examples/shopify-mutation-firewall

Documentation & Guide

README.md

Shopify mutation firewall — support / ops agents

This example is a support or ops agent that mutates a Shopify store through @limetry/shopify. It is not a Shopify App, Admin extension, or Flow automation.

The agent never holds SHOPIFY_ADMIN_TOKEN. ShopifyActionFirewall evaluates an an action intent, then calls Admin API only when Limetry returns allow.

Decisions

Agent toolIntentDecision
issue_customer_refund $10shopify.refundallow — under approval_cost_minor ($25)
set_inventory_levelshopify.inventorydeny — not in allowed_action_types
issue_customer_refund $25shopify.refundapproval_required — meets approval_cost_minor
issue_customer_refund $150shopify.refunddeny — exceeds max_cost_minor ($50)

Copy SKILL.md into the support agent's instructions. Register SUPPORT_OPS_TOOLS with OpenAI or Anthropic tool calling.

import { createStoreFirewall } from "./src/agent-support.js"
import { dispatchSupportOpsTool } from "./src/support-ops-agent.js"

const firewall = createStoreFirewall({
  apiKey: process.env.LIMETRY_API_KEY!,
  adminToken: process.env.SHOPIFY_ADMIN_TOKEN!,
})

const result = await dispatchSupportOpsTool(firewall, "issue_customer_refund", {
  orderId: "1234",
  amountDollars: 10,
})

Live demo (no Shopify App)

.github/workflows/limetry-shopify-gate.yml allows a $10 dry-run refund and denies a $500 refund plus an inventory wipe.

Tests

yarn workspace @examples/shopify-mutation-firewall test

Source Files

6 files in examples/shopify-mutation-firewall
markdown
# Shopify mutation firewall — support / ops agents

This example is a **support or ops agent** that mutates a Shopify store through
`@limetry/shopify`. It is **not** a Shopify App, Admin extension, or Flow automation.

The agent never holds `SHOPIFY_ADMIN_TOKEN`. `ShopifyActionFirewall` evaluates an
an action intent, then calls Admin API only when Limetry returns `allow`.

## Decisions

| Agent tool | Intent | Decision |
| --- | --- | --- |
| `issue_customer_refund` $10 | `shopify.refund` | **allow** — under `approval_cost_minor` ($25) |
| `set_inventory_level` | `shopify.inventory` | **deny** — not in `allowed_action_types` |
| `issue_customer_refund` $25 | `shopify.refund` | **approval_required** — meets `approval_cost_minor` |
| `issue_customer_refund` $150 | `shopify.refund` | **deny** — exceeds `max_cost_minor` ($50) |

Copy [`SKILL.md`](./SKILL.md) into the support agent's instructions. Register
[`SUPPORT_OPS_TOOLS`](./src/support-ops-agent.ts) with OpenAI or Anthropic tool calling.

```typescript
import { createStoreFirewall } from "./src/agent-support.js"
import { dispatchSupportOpsTool } from "./src/support-ops-agent.js"

const firewall = createStoreFirewall({
  apiKey: process.env.LIMETRY_API_KEY!,
  adminToken: process.env.SHOPIFY_ADMIN_TOKEN!,
})

const result = await dispatchSupportOpsTool(firewall, "issue_customer_refund", {
  orderId: "1234",
  amountDollars: 10,
})
```

## Live demo (no Shopify App)

[`.github/workflows/limetry-shopify-gate.yml`](../../.github/workflows/limetry-shopify-gate.yml)
allows a $10 dry-run refund and denies a $500 refund plus an inventory wipe.

## Tests

```bash
yarn workspace @examples/shopify-mutation-firewall test
```