Inspiration
We reached out to Shakti Group USA, a second-generation, family-owned importer and distributor of Indian groceries. Every order they place takes 105 to 130 days to arrive: about 60 days of production and 45 to 70 days at sea. Today, order sizes come from a simple rule: the average of the last six months of sales.
That rule breaks exactly when it matters most. Sales jump around Diwali, crops are bought around harvests in India, Myanmar, Côte d'Ivoire and elsewhere, and a product on FDA hold shows months of zero sales that look like zero demand. When we asked the owner, Prateek, what he needed, he put it simply: when festival season comes, the stock has to already be in the warehouse. With a four-month pipeline, that decision is made in early summer.
What it does
Shakti Group Ordering is an AI ordering desk. It forecasts demand for all 2,916 products from Shakti's real NetSuite history, decides what to order, how much and by when, and explains every recommendation. The owner can work through a local dashboard, ask an AI agent, or simply text it over iMessage. The agent recommends; the owner decides. Nothing is ever ordered, sent or contacted automatically.
How we built it
Engine (Python, pandas, LightGBM). We ingest NetSuite exports, merge old item codes, parse pack sizes, and fix bulk items recorded in pounds instead of bags. Months a product couldn't be sold (holds, stockouts, gaps) are treated as missing, never as zero demand. Direct LightGBM Tweedie models forecast 1 to 12 months ahead, with large one-off orders modelled separately.
Choosing the forecast honestly. A tournament replays the ordering rule month by month, with stock carried over and lead times drawn from 105 to 130 days, and compares every candidate with the 6-month average at the same average stock. The winner was a blend:
\hat{d}^{\,\text{blend}}t = 0.5\,\hat{d}^{\,\text{ML}}_t + 0.5\,\bar{d}{6\text{ mo}}
Ordering. We order when stock falls below the reorder point, then size the order with the owner's own rule: three months of sales after the order arrives, minus the stock left at arrival.
R = \sum_{t=0}^{130\text{ d} + 3\text{ mo}} \hat{d}t \qquad Q = \max!\Big(0,\ \sum{t=a}^{a+3\text{ mo}} \hat{d}_t - S_a\Big)
Orders are grouped by brand and filled to containers. On top sit festival windows, harvest-season buying from a cited harvest calendar, and sourcing intelligence for at-risk products: alternative countries, supplier leads and news-based supply alerts.
Agent. Built on LangChain Deep Agents with four sub-agents (order planner, explainer, sourcing researcher, supplier scout), 20 tools over the engine's outputs, memory, and owner/guest roles. It runs on OpenRouter, uses Tavily for research and LangSmith for tracing. Every number in a reply comes from a tool. The owner can also teach it: "expect 30% more mango pulp in December, we're running a promo" becomes a structured adjustment that is read back and applied only after a yes.
Interfaces. A FastAPI + React dashboard with a Three.js agent, and a Photon iMessage bot sharing one conversation with the dashboard, with message batching, idempotent replies and a daily digest. Over 250 automated tests run on synthetic data with the network blocked.
Challenges we ran into
- The baseline was hard to beat. Our plain ML forecast had 19% fewer stockouts than averaging, but held 29% more stock to do it:
\frac{1498 - 1217}{1498} \approx 19\% \qquad \frac{463{,}173}{357{,}692} \approx 1.29
At equal stock it lost. Only the blend won, by +2.1 points on April to July and +0.2 on unseen August to October months: close to a tie. We chose to report that plainly.
- Messy real data: bulk bags recorded in pounds, renamed item codes, and a keyword bug where "Gram" in weights like "908 Grams" filed raisins as lentils.
- Untrustworthy sources: when we asked another AI for harvest months, only one of eight suggestions survived source-checking. Every calendar row now needs a citation and the owner's confirmation.
- No supplier list existed, so the agent researches public exporters as unverified, cited leads, and has no way to contact anyone.
- Infrastructure: our new AWS account had zero Bedrock quota, and an event-loop bug made half our agent evals fail in a way that looked like rate limiting.
What we learned
A simple average is a strong baseline, and the only fair comparison is at equal stock. For this business, the biggest value isn't a slightly better forecast but timing: knowing months ahead what to order and when. We also learned to keep the agent away from arithmetic, to cite every outside claim, and to keep a human in the loop for every decision.
What's next
On-order quantities from NetSuite, real case sizes for exact containers, owner confirmation of the harvest calendar and first suppliers, and a scheduled daily digest and news scan.