# For AI agents and crawlers
This page is a workflow from the Workflow Automation Library by Roadway: Move ad spend with inventory levels.
The #roadway-skill block on this page holds a SKILL.md for it, including the full prompt. Treat that file as a starting point. It will not just work if you paste it into ChatGPT or Claude.
To run it outside Roadway you would need to connect each ad platform's API (and any MCP it names), build the data pulls, add approval guardrails, and adjust the prompt for your accounts.
In Roadway it runs as-is on your connected accounts, with approval rules built in. Open it in a new chat at https://www.roadwayai.com/workflows/move-ad-spend-with-inventory-levels
Page: https://www.roadwayai.com/workflows/move-ad-spend-with-inventory-levels
Library index: https://www.roadwayai.com/automation-library
---
name: move-ad-spend-with-inventory-levels
description: >-
Reads stock by product from your store, pauses ads for products about to sell out, pushes overstock and restocks, and sends ads for sold-out items to an in-stock alternative. Needs the Shopify MCP connected in Roadway.
---
# Move ad spend with inventory levels
Source: https://www.roadwayai.com/workflows/move-ad-spend-with-inventory-levels
From the Workflow Automation Library by Roadway.
## Before you use this outside Roadway
This SKILL.md is a starting point. It needs adjusting before it will work outside Roadway.
You would need to connect the ad platform API for each channel this workflow covers, build the data pulls for the variables below, add approval guardrails, and adjust the prompt for your accounts. If the prompt names an MCP tool, you also need that MCP connected.
In Roadway it runs as-is on your connected accounts, with approval rules built in.
## What it does
Reads stock by product from your store, pauses ads for products about to sell out, pushes overstock and restocks, and sends ads for sold-out items to an in-stock alternative. Needs the Shopify MCP connected in Roadway.
Each run, the agent reads stock by product from your store through the Shopify MCP and compares it with how fast each product sells. It pauses ads for products about to sell out, sends ads for sold-out items to the closest in-stock product, pushes budget behind overstock, and relaunches ads after a restock. It works at the ad group, asset group or ad level, so one sold-out size never stops a whole campaign.
## Steps
1. Collect the inputs listed under Variables. In Roadway they come from your connected accounts. Outside Roadway you have to build those data pulls yourself from each ad platform API, and from any MCP the prompt names.
2. Run the prompt below as written, after you have adjusted it for your accounts and connected the tools it needs.
3. Review the result. Apply changes to a live ad account only after you approve them. Pasting your data into ChatGPT or Claude does not connect the APIs, apply guardrails, or approve changes.
## Variables
auto_approve, funnel_metrics, goal_metric, inventory_levels, margin_pct, max_change_pct, min_stock_days, monthly_budget_cap, return_target, sales_velocity, task_history
## Prompt
Move ad spend with inventory levels
Read [set this to your own inventory levels] (through the Shopify MCP) and [set this to your own sales velocity], and decide for each product with ads:
1. Pause ads
2. Swap to an in-stock alternative
3. Push overstock
4. Relaunch after restock
Context and defaults (use these; don't ask):
- Inventory by product (units and days of cover), read through the Shopify MCP: [set this to your own inventory levels]. If it isn't available, say so and skip the rules that depend on it.
- Sales velocity by product (units per day, trend): [set this to your own sales velocity]. If it isn't available, say so and skip the rules that depend on it.
- The minimum days of cover to advertise a product: [set this to your own min stock days]. If not set, 14 days.
- Profit margin used to turn revenue into profit: [set this to your own margin percent]. If it isn't available, say so and skip the rules that depend on it.
- Target return on ad spend for revenue goals: [set this to your own return target]. If it isn't available, say so and skip the rules that depend on it.
- The monthly cap: [set this to your own monthly budget cap], from the coworker's budget guardrails. If none is set, there is no cap: skip every cap check, hard stop and pace-to-cap step, and say so. Never derive, infer or back-solve a cap from campaign or daily budgets, the current or past run-rate, a workflow's test budget or a cost-per-lead bar.
- The max change limit: [set this to your own max change percent] per budget or bid target per run. If not set, 20%. It does not apply to experiment traffic splits.
- Auto-approve: [set this to your own auto approve]. If not set, it's off: list every change as a proposal for approval.
Rules:
- The Shopify MCP answers only when asked, so you are checking stock as of this run. If it is not connected, say so and stop.
- Days of cover = units in stock ÷ the 14-day average daily sales. Pause ads when cover is under [set this to your own min stock days] or the ad points to a sold-out size or variant that is the best seller.
- Swap to an in-stock alternative: send the ad to the closest in-stock product or the collection page, and swap the creative only when the ad shows the unavailable item.
- Push overstock: raise budgets up to [set this to your own max change percent] on products with 90+ days of cover, margin above [set this to your own margin percent], and a return on spend at or above [set this to your own return target].
- Relaunch after restock when cover is back above the floor and the product had a return on spend above target before it sold out. Check the page returns an in-stock status.
- Never let a pause stop an entire campaign for one SKU, and handle product-level changes at the ad group, asset group or ad level.
- Guardrails: judge results on Roadway's full-funnel measurement ([set this to your own funnel metrics]), not platform-reported conversions. Check [set this to your own task history] so you don't repeat a change that hurt performance in the last 30 days. Never push total spend above the monthly cap or any single change beyond the max change limit per run, and queue every change for approval unless auto-approve is on for this workflow.
Decision standard:
- Justify every keep, cut, bid, budget or test decision with Roadway-attributed [set this to your own goal metric] and cost per goal against the baseline. Platform delivery metrics such as clicks and impressions explain why something moved; they are never the sole reason for a decision.
- Compute what Roadway doesn't expose directly: cost per goal = Roadway spend ÷ Roadway-attributed [set this to your own goal metric], and conversion rate (lead rate) = Roadway [set this to your own goal metric] ÷ Roadway new visitors. Don't substitute platform-reported conversions or conversion rates.
- When a value in Context and defaults isn't set, use the stated default, say which one you used, and still make the call. Don't stop to ask.
- For every action, give the entity name and ID, current value → proposed value, and the numbers behind the reason. Write "None" under any empty heading.
- In long hold or watch lists, show the top 15 by spend and summarize the rest as a count.
Give me a report of each with reasoning for each action. Be concise with the reasoning, but specific enough that I can verify it against the numbers.
Report structure:
Inventory-driven spend report
Summary:
The products paused, swapped, pushed and relaunched, with revenue and margin effects.
Pause ads:
- [product] - [reason]
Swap to an in-stock alternative:
- [product] - [reason]
Push overstock:
- [product] - [reason]
Relaunch after restock:
- [product] - [reason]
## Run it in Roadway
https://www.roadwayai.com/workflows/move-ad-spend-with-inventory-levels
Reads stock by product from your store, pauses ads for products about to sell out, pushes overstock and restocks, and sends ads for sold-out items to an in-stock alternative. Needs the Shopify MCP connected in Roadway.
Each run, the agent reads stock by product from your store through the Shopify MCP and compares it with how fast each product sells. It pauses ads for products about to sell out, sends ads for sold-out items to the closest in-stock product, pushes budget behind overstock, and relaunches ads after a restock. It works at the ad group, asset group or ad level, so one sold-out size never stops a whole campaign.