AI Agents for Inventory Management: A Practical Guide
How AI fits inventory work: demand forecasting with StatsForecast, safety stock and reorder point formulas, and an LLM agent that drafts POs for approval.
AI in inventory management is less about a single autonomous system and more about three layers that each do one job: a forecasting model that predicts demand per item, plain inventory formulas that turn the forecast into safety stock and reorder points, and, more recently, an LLM agent that lets planners ask questions of the data and prepares purchase orders for someone to sign off. This guide covers each layer with sources from the library and vendor documentation, a small working forecast, and the limits you should plan for.
The three layers
| Layer | What it does | Typical tool |
|---|---|---|
| Forecasting | Predicts future demand per item from sales history | A time series library such as StatsForecast or AutoGluon |
| Inventory policy | Converts the forecast into safety stock, reorder point and order size | Formulas in your ERP or a spreadsheet |
| LLM agent | Answers questions about stock and drafts orders through tools you define | An LLM API with tool use |
Keeping these separate matters. The forecast and the formulas are deterministic and testable; the agent sits on top and should never be the thing that does the arithmetic.
Demand forecasting with StatsForecast
StatsForecast is an Apache-2.0 Python library from Nixtla. It bundles common univariate models, including automatic ARIMA, ETS, CES and Theta, plus baseline models for benchmarking. For inventory, two parts of its model list stand out: the intermittent-demand family (Croston variants, ADIDA, IMAPA, TSB), aimed at series where most periods show zero sales, which is common for spare parts and slow movers; and probabilistic forecasts, which give you a range rather than one number.
The quick start expects a long-format table with three columns: unique_id (the series, for you usually a SKU or SKU-location pair), ds (the date) and y (the value to forecast, here units sold). The example below is the official quick start, which uses the classic monthly air passengers dataset in place of sales data:
import pandas as pd
from statsforecast import StatsForecast
from statsforecast.models import AutoARIMA
df = pd.read_csv('https://datasets-nixtla.s3.amazonaws.com/air-passengers.csv', parse_dates=['ds'])
sf = StatsForecast(
models=[AutoARIMA(season_length=12)],
freq='MS',
)
sf.fit(df)
forecast_df = sf.predict(h=12, level=[90])
season_length=12 tells the model to expect a yearly cycle in monthly data, h=12 asks for twelve periods ahead, and level adds lower and upper interval columns (AutoARIMA-lo-90, AutoARIMA-hi-90) next to the point forecast. To use it for inventory, replace the CSV with your own sales history, one row per SKU per period. The docs suggest the forecast method when you have many series.
If you would rather let an AutoML tool pick and ensemble models, AutoGluon offers a TimeSeriesPredictor for the same job. Either way, the output you need downstream is the same: expected demand per item per period, and some measure of how wrong it tends to be.
Safety stock and reorder points
The formulas below come from Oracle’s reorder point planning help for Oracle Inventory (an archived edition of the documentation, but the definitions are standard).
Reorder point. Oracle defines it as:
reorder point = safety stock + forecast demand during lead time
A new order is suggested once the available quantity, meaning on-hand stock plus planned receipts, falls below that level. Lead time here is the sum of the item’s processing, preprocessing and postprocessing lead times. The logic is that if the forecast is right and the delivery is on time, stock should be sitting at exactly the safety stock level when the order lands.
Safety stock. Oracle offers two built-in methods. The first is a fixed share of forecast demand per period. The second ties the buffer to how accurate your past forecasts have been:
safety stock = Z × (1.25 × MAD)
MAD is the mean absolute deviation between historic forecasts and actual demand, and Z is the value from the normal distribution that matches the service level you choose. A model that has tracked demand closely needs only a small buffer; a noisy one needs more.
Order size. When the reorder point triggers, Oracle uses an economic order quantity, a fixed amount chosen to minimise the combined cost of ordering and holding stock.
A worked example with made-up numbers: a SKU’s forecasts have missed actual demand by 20 units per period on average (MAD = 20). With Z = 2, safety stock is 2 × 1.25 × 20 = 50 units. If forecast demand over the lead time is 300 units, the reorder point is 350.
This is where the forecasting layer plugs in. The point forecast summed over the lead time gives the demand term; the forecast errors you measure in backtests (StatsForecast has a cross-validation tutorial for this) give you MAD.
What ERP vendors say they ship
Large ERP suites already contain parts of this stack. These are the vendors’ own descriptions, not independent evaluations.
- Oracle Inventory says it can create requisitions automatically when the reorder point planning report finds items that need replenishing, so purchasing gets the request without someone keying it in.
- Microsoft Dynamics 365 Supply Chain Management has built-in demand forecasting that sends a summary of historical transactions to Azure Machine Learning. Its experiments choose the best fit from five time series methods to produce a baseline. Planners can view and adjust the forecast, but adjusted forecasts have to be authorised before master planning uses them. Microsoft itself says the feature may not suit commerce, wholesale or warehousing customers, and now points people to its newer Demand planning product instead.
The pattern worth copying from both: the system proposes, and a person or an explicit authorisation step decides.
Where an LLM agent fits
An LLM does not improve the forecast or the formulas. What it adds is a natural-language front end over them and the ability to prepare paperwork. Two jobs suit it well:
- Querying stock data. A planner asks which items at one warehouse are below their reorder point and when the next delivery is due. The agent calls read-only tools against your inventory database and summarises the answer.
- Drafting purchase orders. For items below their reorder point, the agent fills in a draft PO with supplier, quantity (the EOQ or your own rule) and the reasons, then leaves it in a queue for a buyer to approve.
Claude’s tool use works this way: you describe each tool with a name, description and JSON input schema; Claude replies with a tool_use block naming the tool and its arguments; your code runs it and sends back a tool_result. Because your application executes every call, the agent can only do what your tools allow. A minimal tool set for this pattern:
tools = [
{
"name": "get_stock_position",
"description": "Return on-hand, on-order, safety stock and reorder point for a SKU at a location.",
"input_schema": {
"type": "object",
"properties": {"sku": {"type": "string"}, "location": {"type": "string"}},
"required": ["sku", "location"],
},
},
{
"name": "create_draft_po",
"description": "Create a DRAFT purchase order. Drafts are reviewed by a buyer; this tool cannot submit orders.",
"input_schema": {
"type": "object",
"properties": {
"supplier_id": {"type": "string"},
"sku": {"type": "string"},
"quantity": {"type": "integer"},
"reason": {"type": "string"},
},
"required": ["supplier_id", "sku", "quantity", "reason"],
},
},
]
Notice there is no submit_po tool. The quantity the agent proposes should come from your reorder logic, which get_stock_position returns, not from the model’s own maths, and the create_draft_po handler should re-check it against your rules before saving. The same draft-then-approve flow is used in our receipt processing build, and our piece on designing human-AI collaboration covers how to present drafts so reviewers actually check them. For wiring tools to real systems with auth and retries, see connecting an AI agent to APIs.
Limits to plan for
- Forecasts are only as good as the history. New products, promotions, stockouts (which hide true demand) and one-off events all distort the series. Dynamics 365 includes outlier removal for this reason; whatever tool you use, clean the data first.
- The formulas assume a lot. The Z-based safety stock method leans on normally distributed forecast errors and reliable lead times. Intermittent items and suppliers with erratic delivery break those assumptions.
- LLMs guess. Anthropic’s docs warn that when a required input is missing, Claude, “particularly Claude Sonnet”, might fill in a value the user never gave. Mark inputs as required, consider
strict: trueso calls match your schema, and have the handler reject anything implausible. - Accountability stays with people. Keep write actions behind approval, log every tool call and draft, and review a sample of the agent’s answers against the source data on a regular basis.
Start with the forecast and the reorder formulas, measure how they perform on past data, and add the agent last, as a convenience over a system that already works without it.
Written by AI Agents Directory
Editorial team
Facts in this guide are checked against official documentation and repositories, which are linked in the article.