klaviyo-vercel-shop-agent

Installation
SKILL.md

Klaviyo for Vercel Shop's Shop Agent

This skill lets Shop Agent, Vercel Shop's built-in AI shopping assistant, offer a back-in-stock email when the variant a shopper wants is sold out, subscribe them through Klaviyo, and record in Klaviyo that the agent did it. A shopper who asks for a size that's gone gets the same alert as the product page's Notify me form, and the store can segment and report on shoppers the agent helped.

The agent faces shoppers, so it gets no more access to Klaviyo than the browser has: one tool that calls Klaviyo's public client API with the public key. The Klaviyo event and profile property are sent from the shopper's browser after the tool succeeds, through the same consent-gated queue as every other storefront event, and never include anything the shopper typed. The agent never gets a Klaviyo private key, as a tool, an environment variable or a connection.

Ask before every change to the user's project or Klaviyo account.

Step 0 — Check the prerequisites

  1. Klaviyo is on the storefront. lib/klaviyo/index.ts exports postKlaviyoClientApi and toShopAgentBackInStock, and lib/config/index.ts has analytics.klaviyo.backInStock. If not, apply klaviyo-vercel-shop first.
  2. Shop Agent is set up, or the user is ready to turn it on. Shop Agent is off in stock Vercel Shop (agent.isEnabled: false in lib/config/index.ts). If it's off, ask whether the user has followed Vercel Shop's Shop Agent guide, which covers model access (AI Gateway on Vercel; locally vercel env pull or AI_GATEWAY_API_KEY), bot protection and spending limits. If they have, turn it on with edit 3 in references/code-changes.md. If not, add the tool and bridge anyway, so they work once the agent is on, and leave it off.
  3. Back in Stock works without the agent. Back in Stock is turned on in Klaviyo, and Klaviyo's Shopify integration syncs the catalog, so variant IDs resolve. The agent uses the same API as the product page's form.
  4. Already applied? If agent/tools/notify-when-back-in-stock.ts exists, compare it with the asset, report differences, and ask before replacing it. Each edit below says how to tell it's already there.

Step 1 — Add the tool and the bridge

Copy these into the project at the same paths, unchanged:

Installs
1
First Seen
11 days ago