Skip to content
CasesHeritage · Purchasing and inventory management · July 28, 2026

How Heritage uses AI to manage purchasing

The agent tracks raw-material stock, sends a weekly purchasing report, and prepares draft orders in the ERP: what to buy, how much, and from whom.

Materials
3 groups
Horween, cordovan, straps
Report
Weekly
+ on demand in Telegram
Orders
Drafts
on request, a human confirms
Data
MoySklad + PlanFact
+ CBR rate
Stage
In production
24/7 on a server

Heritage is a brand of premium handmade leather goods: belts, wallets, bags, accessories, with its own production. It works on Horween leather from the US. And leather is exactly the bottleneck of the whole business: without it production stops, and you can't get it quickly. I built Heritage an AI agent that watches the raw materials, works out what and how much to order, and sends a purchasing report once a week on its own.

The short version

The agent is connected to the MoySklad accounting system and tracks raw-material stock by specific positions. It knows which materials are bought from which supplier, calculates the average consumption, and understands how many days each position will last given its delivery time. Once a week it sends a report to the work chat: what is running out, how long it will last, how much to order and for what amount. On command it prepares draft orders right in MoySklad, and whether to post them and send them to the supplier is decided by a human.

The system is in production and runs on a server 24/7 as a Telegram bot.

The problem: leather runs out, and delivery is slow

Purchasing is a headache of its own at Heritage, and here is why.

  • Material regularly hit zero. Stock was checked by eye, and shortages were noticed after the fact, when it was already too late to order.
  • Delivery is slow. Leather travels from the US for about a month and a half. While a scarce position is on its way, finished goods for clients sit and wait.
  • Purchases are large and prepaid. An order needs a significant sum set aside, and free cash isn't always there. Getting the timing or the volume wrong is expensive.
  • Logistics are tricky. Different suppliers, different regions, different lead times. All of it used to be kept in someone's head.

Taken together, the company waited a long time for leather, and purchasing lived on the manual control of the operations manager: she looked at stock and reserves, checked them against reality, put together a list, and got it approved. The process rested on a person and had no logistics math under it.

What the agent does now

Everything below is in production.

  • Tracks three groups of materials: Horween leather (by color and thickness, in dm²), Rocado shell cordovan (in pieces), and belt straps (in pieces, a separate supplier). These are different units of measure, and the agent counts each in its own units.
  • Calculates the reorder signal for every position: how much is available, how long it will last, the reorder point, how much to order and for what amount.
  • Groups the order by supplier. The agent knows what is actually bought from whom and collects positions into baskets by supplier, so the purchase isn't split up.
  • Prepares draft orders in MoySklad with a rationale: for each position you can see how much is left, how it's being used, and why the volume is what it is.
  • Shows the money. The order cost is taken from the last purchase and recalculated at the current CBR exchange rate, because the materials are priced in foreign currency.
  • Works on its own and on request. Once a week the report comes to the work chat, and at any moment it can be called with a command.

How it's built

The unit of accounting is a specific SKU, for example "Horween leather, black, 1.6 mm". For each such position the agent calculates two things.

How much is really available. Not just the stock on hand, but the stock minus reserves for already-accepted orders plus what is already in transit. Only this shows a realistic picture: there may be a lot on the shelf, but almost all of it is already promised to clients.

When it's time to order. This is the reorder point: average daily consumption multiplied by the delivery time plus safety stock. We calculated the average delivery time from past orders and set it per region, because the materials come from different places: from the US about 47 days, from China around 35, within Russia around 30. If what's available drops below the reorder point, the position turns red and lands in the report.

The order volume is calculated as the top-up to the target stock, rounded to real purchase units: leather is bought in hides, cordovan in shells, straps in pieces.

You talk to the agent in Telegram with two commands:

  • /inventory send the stock report right now, to the chat it was called from.
  • /order assemble draft supplier orders in MoySklad by the current baskets. The draft is not posted, nothing goes to the supplier, and the rationale is written into the comment of each order. A human checks and posts it.

And once a week the same report comes to the work chat on its own, with no command.

Where the line is

This part matters, and it's about trust. On the data side, the agent works read-only. The single write it makes is a draft order via the /order command. It does not post orders, does not send them to the supplier, and pays for nothing. The reason is simple: purchasing is the company's real, prepaid money, and the cost of a mistake in irreversible actions is too high. So the decision always stays with a human, and the agent prepares it and makes it transparent.

Technically it's a Telegram bot on Node.js that reads MoySklad, PlanFact and the CBR rate, and lives in a container on a dedicated server. It used to run on a laptop, but after a real outage caused by the laptop being switched off, we moved it to a server for reliable 24/7 operation.

What's next

The product is designed to be broader, and I'll say honestly which of this is still on the roadmap rather than in production.

  • Auto-tuning of lead times: right now the average delivery time per region is set as a fixed value; next we want to adjust it automatically from the history of receipts, and take safety stock from the spread.
  • A link to money: connect purchasing with a payment calendar, so the order plan accounts for when the money for it will actually be there. This ties in with Heritage's finance agent.
  • More materials and suppliers: bring in hardware and the remaining positions that are outside the loop for now.

The result

Manual control of purchasing turned into clear math: the agent watches the stock itself, calculates the reorder point accounting for the long delivery, and once a week brings a ready list of what to order, how much, and for what amount. The order is assembled with one command, with a transparent rationale, and the decision stays with a human. This is the third agent I built for Heritage, alongside its own CRM instead of AmoCRM and its finance agent.


If your purchasing also rests on manual control, and material keeps hitting zero, an agent like this can be built around your positions, lead times, and accounting system. Write to me on Telegram or leave a request. Tell me where your supply chain breaks most often, and I'll tell you honestly what's worth handing to an agent.

Stack

Agent
Node.js (ESM)native fetch
Data
MoySkladPlanFactCBR rate
Channel
Telegram Bot API
Infrastructure
Docker ComposeHetzner (VPS)
Get in touch

Want to automate something in your business?

Tell me what you're sick of doing by hand. 30 minutes for a brief, then a concrete offer or an honest no if it's not my kind of task.