Back to Work
AI Agent2026
StockPilot
AIAWS CDKClaudeData PipelineShopify
An autonomous AI agent that monitors inventory, analyzes sales trends, and executes restocking decisions across multiple Shopify stores without human intervention.
The Challenge
Managing inventory across multiple Shopify stores meant constant manual monitoring, delayed restock decisions, and missed sales opportunities during peak periods. Merchants needed a system that could think and act on its own.
The Solution
Built a multi-agent system powered by Claude that ingests real-time Shopify webhooks, processes sales velocity data through AWS Lambda pipelines, and autonomously creates purchase orders when inventory drops below dynamically calculated thresholds.
Design
Code
Result
agent/restock-decision.tstypescript
1export async function evaluateRestockDecision(2 sku: string,3 context: InventoryContext4): Promise<RestockDecision> {5 const salesVelocity = await calculateVelocity(sku, 30)6 const currentStock = context.availableQuantity7 const leadTime = context.supplier.avgLeadTimeDays89 const daysOfStock = currentStock / salesVelocity.unitsPerDay10 const reorderPoint = salesVelocity.unitsPerDay * leadTime * 1.31112 if (currentStock <= reorderPoint) {13 const orderQty = Math.ceil(14 salesVelocity.unitsPerDay * leadTime * 2 - currentStock15 )1617 const decision = await claude.messages.create({18 model: 'claude-sonnet-4-20250514',19 messages: [{20 role: 'user',21 content: buildRestockPrompt(sku, {22 salesVelocity,23 currentStock,24 orderQty,25 seasonalTrends: context.trends,26 }),27 }],28 })2930 return parseRestockDecision(decision, orderQty)31 }3233 return { action: 'hold', reason: `${daysOfStock.toFixed(0)}d remaining` }34}35
Scroll to explore
Tech Stack
Claude APIAWS CDKLambdaDynamoDBSQSEventBridgeShopify Admin APITypeScript
Interested in similar work?
Let's discuss how I can help bring your Shopify project to life.