AI agent 05 · Shopify storefront · theme app extension

Storefront Support Agent

A chat widget that answers shoppers about products, sizing, shipping and their orders from the store's real data. It can only use five tools. It shows an order only when the order number and the email match. Every reply is checked in code before the shopper sees it, and anything it cannot do goes to a person.

v1 · 15 tests · 20/20 evals in demo modelive-model eval not run yetClaude APITheme app extensionApp proxyAdmin + Storefront GraphQL

Try it

This runs the repo's real tools, order check, guards and handoff logic in your browser, on the sample store (products from Shopify's public mock.shop, generated orders). Only the model is swapped for a simple keyword router, so the wording is plainer than Claude's — the point is to see the tool calls and checks on the right.

● support agent · demo driver · sample storenothing leaves your browser

Tool calls & checks

Each message shows the tools the agent called, what they returned, and whether the reply passed the guards.

The problem

Most store inboxes are the same ten questions: where is my order, does it run small, how do returns work, do you have it in blue. Generic chatbots either cannot see the store's data or invent answers — a wrong price, a discount code that does not exist, "I've refunded you" when nothing happened. That costs more than the time it saves.

How it works

ShopperTypes in the widget (theme app extension)
App proxyShopify signs the request; the server checks the HMAC and timestamp
Agent ≤ 6 tool callssearch_products · get_product · get_policy · lookup_order · create_handoff
GuardsReply checked against what the tools returned
TeamGets a ticket for anything the agent cannot do or got wrong
Code decidesAI helpsA person decides

On a real store

The support widget open on the local demo page: a product answer with a product card, then an order status answer with tracking number, with the tool-call count shown

The widget on the repo's local demo page (server + widget, demo mode, products live from mock.shop).

What code checks — not the prompt

RiskCheck
Showing someone else's orderlookup_order needs number + email; same "no match" answer for either wrong; locked after 3 failed tries; never returns address, payment or notes
Invented pricesEvery $ amount in the reply must appear in a tool result or the policy text
Made-up discount codesAny "code XYZ123" in a reply blocks it
"I've refunded your order"First-person action claims are blocked — the agent has no tool that changes anything
Talking about an order it never verifiedOrder numbers in the reply must be in the verified set for this chat
Recommending a product it never looked upProduct cards only for handles a tool returned
Instructions hidden in reviews or messagesReviews arrive as reviews_untrusted; the prompt says to treat them as data; the guards above hold either way

A failed draft is never shown. The shopper gets "I've passed this to our team", and the ticket records which check failed — so the team sees the model's mistakes instead of the customer.

Results

WhatResult
Unit tests (order access, lockout, guards, PII redaction, app proxy signature using Shopify's documented example)15 / 15 pass
Eval set: 20 conversations with exact expected facts (products, policies, orders, wrong email, address change, defect, injection)20 / 20 in demo mode
Same eval set with ClaudeNot run yet — will be published with misses
Theme app extension (Theme Check)0 offenses
Installed on a real storeNot yet

Demo-mode evals prove the tools, guards and wiring, not the model's judgement. The live number is the one that matters for a client, and it is the next step.

Bugs the evals caught on the first run

What AI wrote vs what I decided

AI (Claude Code)

Drafted the tools, the agent loop, the widget, the backends and most tests from my spec; validated the GraphQL with the Shopify AI Toolkit.

Me

Chose the five tools and what each may return, the "number + email" rule, the guard list, the handoff cases and the eval cases with their expected answers; reviewed and fixed the code.