Tutorials
TutorialIntermediate2026-07-05

Supply Chain Outlier Detection 101: Build a simple demand-sensing review team with AI agents

Supply Chain Outlier Detection 101: Build a simple demand-sensing review team with AI agents

Objective

Create a simple three-agent team that reviews daily or weekly demand observations and classifies each unusual value as a probable data error, known event, temporary demand shock, emerging structural change or unresolved exception requiring planner review.

The system may recommend forecast treatment, but it must not modify the official demand plan automatically.

Example data

Use one CSV file containing date, SKU, location, actual demand, baseline forecast, promotion flag, stock availability, price and customer order count.

Add a second file containing selected external signals such as weather, holidays, local events, search trends, promotional activity or competitor events. Use only signals with a plausible causal relationship to the product.

Agent 1 — Detector

Task: identify observations materially different from the baseline forecast.

Start with a simple, explainable rule:

residual = actual demand - baseline forecast

Flag an observation when the residual is more than three recent median absolute deviations from the median residual.

This robust rule is a practical starting point because it is less sensitive to extreme observations than a mean-and-standard-deviation threshold.

Required output: SKU, location, date, actual demand, baseline forecast, deviation, outlier score and initial confidence.

Agent 2 — Context investigator

Task: determine whether the outlier has a plausible explanation.

Check promotion or price changes, stockout recovery, lost sales, duplicate orders, product launches or delistings, calendar effects, weather, local or industry events, customer concentration, channel concentration and similar movement in related products.

The agent must cite the supporting source or data field. It must not invent an explanation.

Agent 3 — QA and planner gate

Task: challenge the classification and proposed forecast treatment.

Possible decisions:

  • Correct the data: only when the observation is demonstrably invalid.
  • Keep as history but exclude from baseline fitting: for a documented one-off event.
  • Include as a demand signal: when recent internal or external evidence indicates a genuine shift.
  • Monitor: when evidence is insufficient.
  • Escalate: when the financial or service impact is material.

The QA agent should reject any conclusion that lacks evidence or relies only on the size of the statistical deviation.

Workflow

  1. Load the baseline forecast and recent actual demand.
  2. Calculate residuals and outlier scores.
  3. Rank observations by service or inventory impact.
  4. Enrich the top outliers with internal and external context.
  5. Classify the likely cause.
  6. Propose forecast treatment.
  7. Route material or uncertain cases to a planner.
  8. Record the planner’s final decision as reviewed memory.

Example output

SKUSignalInitial flagContextRecommended treatment
ICE-01+85%High positive outlierHeatwave forecast and regional upliftTemporary near-term uplift
PART-22+300%Extreme outlierDuplicate order IDCorrect source data
PROD-07+40% for three periodsPersistent shiftNew customer and rising order countRe-estimate baseline
ITEM-14-70%Negative outlierStock unavailableTreat as censored demand

Controls

  • Never replace an outlier automatically.
  • Preserve the original observation.
  • Separate statistical detection from business interpretation.
  • Record the internal and external evidence supporting each decision.
  • Require planner approval for forecast changes.
  • Monitor whether adjusted forecasts improve accuracy and service.
  • Prevent external signals from overpowering actual demand without validation.

Acceptance criteria

  • Every flagged observation retains its original value.
  • Every classification includes evidence.
  • No forecast is changed without approval.
  • False-positive rates are measured.
  • Forecast accuracy is compared before and after adjustment.
  • Service and inventory effects are reported separately.

Dataleo perspective

Outlier detection should not be treated as a data-cleaning step. It should be treated as a decision workflow.

The statistical model identifies what is unusual. The demand-sensing process must determine whether the signal represents bad data, a temporary event or a structural change.

The condition for value is traceable classification linked to forecast treatment. The main trade-off is responsiveness versus plan nervousness: reacting too slowly misses emerging demand, while reacting to every anomaly destabilizes replenishment and production.

Source adaptation: this is an original Dataleo Supply Chain tutorial inspired by Julia Danyal’s agent-team pattern. The Supply Chain method, controls and examples are Dataleo’s adaptation.