DEV Community

Hieu Luong
Hieu Luong

Posted on Originally published at himitek.com

Case Study: How a Pharmaceutical Distributor Saved VND 480 Million per Year with an AI Inventory Agent

1. Pain – One incorrect inventory figure can cost an entire batch

Mai, the manager of a pharmaceutical distributor in Binh Duong, believed the warehouse was under control because the software still showed sufficient stock. But when a pharmacy needed an urgent delivery, staff could not locate the correct batch. Receiving and issuing documents were read by eye, entered manually, and reconciled at the end of the day. Much of the operation was still running on people and spreadsheets.

The biggest risk was not only a quantity mismatch. Near-expiry products could be overlooked, the wrong batch could be shipped, or usable inventory could be discarded. Staff had to perform after-hours counts while management learned about problems only after an order was delayed.

2. Agitate – Hidden costs were eroding the margin

Every error created a bill: discarded products, overtime, redelivery costs, and damaged trust with pharmacies. Mai’s team spent about three hours on end-of-day reconciliation, creating a bottleneck before the next morning’s delivery shift. One incorrect batch code could keep several employees searching for hours.

Hiring more people to patch the process would increase fixed costs and technical debt. Relying on disconnected spreadsheets would make the data even harder to control. This is half-baked optimization: reports look complete while near-expiry stock remains forgotten on the shelf. A rushed project plan before clarifying the operating process can turn into wasted money; one corrupted file or power outage can also stop an entire shift.

3. Solve – A practical three-step implementation

Step 1: Standardize data and read documents. The AI Agent reads receiving and issuing documents, identifies SKU, batch number, and expiry date, then reconciles them with the existing ERP or Google Sheets. HimiTrace and WooCommerce TraceBatch can support GS1 EPCIS 2.0 and QR traceability for each SKU and batch, replacing scattered manual records.

Step 2: Detect discrepancies and prioritize action. The Agent compares physical stock with system records, alerts the team when items are running low or nearing expiry, and recommends FEFO dispatch order. Exceptions are routed to a manager for approval instead of being changed automatically.

def check_batch(batch, system_qty, today):
    alerts = []
    if batch['qty'] != system_qty:
        alerts.append('Inventory mismatch: perform count')
    if batch['expiry_days'] <= 60:
        alerts.append('Near-expiry batch alert')
    return {'sku': batch['sku'], 'batch': batch['lot'], 'alerts': alerts}

for batch in inbound_outbound_batches:
    result = check_batch(batch, erp.get(batch['sku'], 0), today)
    if result['alerts']:
        approval_queue.append(result)
Enter fullscreen mode Exit fullscreen mode

Step 3: Control Agent actions. HimiTek deploys OpenClaw Gatekeeper with 9router v0.4.66 and LiteLLM dual-instance failover. Rate limiting, automatic API key rotation, and a hard 5 USD monthly budget cap per virtual key help prevent runaway loops. The Reasoner only analyzes; the Actuator executes approved scripts. Dangerous shell commands remain locked unless whitelisted or explicitly authorized. Start with a checklist: end-of-day reconciliation, near-expiry alerts, risk-based count lists, and only then expand.

After a three-month pilot at a simulated distribution center, end-of-day reconciliation fell from three hours to about 25 minutes, manual counting hours dropped by 70%, and overlooked near-expiry products fell by 35%. By reducing write-offs, overtime, and inventory leakage, the estimated saving reached approximately VND 480 million per year without hiring additional warehouse staff.

4. CTA – Turn inventory control into measurable savings

Do not begin with a large system or an oversized project plan. Give HimiTek 30 days of receiving and issuing data, batch numbers, expiry dates, and overtime costs. We can identify the actual leakage points and deploy the AI Agent step by step, preserving the current ERP while measuring minutes saved, products avoided from write-off, and labor costs reduced.

Top comments (0)