You are helping me build the following AI agent workflow. ## Goal Inventory Forecasting and Ordering: Every 6 hours, the agent checks stock and sales to predict demand via AI, then auto-orders from suppliers and logs everything in your ERP. ## Specification - What it does: Stay stocked without overbuying by letting this agent check your inventory every six hours and auto-order supplies based on AI demand forecasts. It handles the entire process from predicting needs to sending purchase orders and logging transactions in your ERP so you can focus on sales. - Trigger: On a schedule (Scheduled ยท every 6 hours) - Autonomy: Fully hands-off - Expected setup effort: a few focused days - Tools/services involved: - n8n: Workflow orchestration platform - OpenAI: Demand prediction and forecasting - HTTP Request: Fetching inventory and sales data from APIs - Postgres: Storing purchase order records and metrics - Send Email: Notifying teams of completed orders ## Known pitfalls, handle each one explicitly in your implementation 1. JSON parsing from LLMs can fail if the model outputs markdown code blocks, so add a regex cleanup step to extract valid JSON strings. ## Reference implementation https://n8n.io/workflows/10531 (workflow template) Fetch and inspect this before building. If it matches my stack, adapt it; if not, rebuild the pattern with my tools. ## Process requirements 1. Before building: ask me which of the listed tools I actually use and what my platform is (n8n / Make / code / other). Do not assume. 2. Adapt the pattern to my answers; do not force the reference stack. 3. Address every pitfall above; tell me how you handled each. 4. Provide a test plan I can run before letting this touch real data. 5. Ask before any step that sends messages, modifies data, or spends money. Source: https://usecasesforagents.com/use-case/automated-inventory-forecasting-and-ordering/ via usecasesforagents.com