Autonomous Replenishment Agent Stress Simulation Builder
Build a simulation test script to evaluate autonomous inventory replenishment agents against volatile retail supply chain disruptions.
Use this template when validating the algorithmic robustness of autonomous replenishment agents in fast-moving consumer goods. It generates an executable simulation script that injects synthetic supply disruptions and evaluates ordering accuracy and safety stock maintenance.
Role: Staff Supply Chain Automation Architect evaluating autonomous retail inventory and replenishment agent workflows.
Context
- Retail Merchandising Sector: {{retail_category}}
- Agent Decision Module: {{inventory_agent_logic}}
- Baseline Supply Shock Dataset: {{historical_stockout_data}}
- Lead Time Uncertainty Range: {{supplier_lead_time_variance}}
- Cost Overrun Threshold: {{cost_discrepancy_cap}}
- Evaluation Horizon: {{evaluation_window_days}}
Task
Produce an automated Python simulation script that feeds synthetic supply disruptions, surge demand, and lead-time delays into {{inventory_agent_logic}} over {{evaluation_window_days}} days, measuring fill-rate preservation and penalizing order cost spikes above {{cost_discrepancy_cap}}.
Method
- Model synthetic daily demand curves tailored to {{retail_category}}, incorporating weekend peaks and seasonal stockout risks from {{historical_stockout_data}}.
- Inject stochastic lead time delays governed by {{supplier_lead_time_variance}} to test the agent's buffer calculation.
- Execute step-by-step stateful simulations where {{inventory_agent_logic}} receives current stock levels, open purchase orders, and forecasts.
- Compute inventory holding costs, stockout penalties, and purchase cost deviations against the static threshold {{cost_discrepancy_cap}}.
- Evaluate autonomous reorder quantity decisions against ground-truth dynamic safety stock formulas.
- Log automated pass/fail flags for bullwhip amplification, phantom inventory recovery, and minimum order quantity violations.
- Output tabular performance diagnostics and export scenario results into structured CSV/JSON formats.
Constraints
- The script MUST utilize standard data science libraries (numpy, pandas) and provide fully reproducible seeds.
- The evaluation MUST NOT permit negative inventory states without triggering severe penalty flags.
- You MUST generate mock interfaces for {{inventory_agent_logic}} so the script runs out of the box.
- All metrics must strictly evaluate decisions across the full {{evaluation_window_days}} timeline.
Output format
- Section 1: Simulation configuration and test parameter constants.
- Section 2: Mock Agent Interface and Supply Environment Simulation Class.
- Section 3: Core Evaluation Runner and KPI Calculator (Stockout Rate, Cost Overrun, Bullwhip Index).
- Section 4: Main execution block running 3 distinct disruption scenarios.
Self-review
- Confirm that {{supplier_lead_time_variance}} is mathematically applied to replenishment delivery steps.
- Verify that budget overruns exceeding {{cost_discrepancy_cap}} trigger explicit assertion failures.
- Check that the script executes cleanly within standard Python 3 environments without proprietary dependencies.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.