AI agent that consolidates restock requirements by supplier, generates consolidated purchase orders, and tracks supplier performance.
import requests, json, pandas as pd
SUPPLIER_API = "https://api.example.com/suppliers"
INVENTORY_API = "https://api.example.com/restock"
def fetch_suppliers():
resp = requests.get(SUPPLIER_API + "/list")
return resp.json().get("suppliers", [])
def consolidate_restock(suppliers):
orders = []
for s in suppliers:
restock = requests.get(INVENTORY_API,
params={"supplier_id": s["id"]}).json()
total_qty = sum(i["qty"] for i in restock["items"])
total_cost = sum(i["qty"] * i["unit_price"] for i in restock["items"])
lead_times = [i["lead_days"] for i in restock["items"]]
flagged = [i for i in restock["items"] if i["lead_days"] > 10]
orders.append({
"supplier": s["name"],
"items": len(restock["items"]),
"total_qty": total_qty,
"total_cost": total_cost,
"max_lead": max(lead_times),
"flagged": len(flagged),
"draft_po": f"PO-{s['id']}-{total_cost:.0f}"
})
return orders
purchase_orders = consolidate_restock(fetch_suppliers())
print(json.dumps(purchase_orders, indent=2))
Basic Package
Special SME traction programme by AINNA.
Limited starter website offer. AI usage, hosting, maintenance and custom integrations depend on the confirmed scope.
View SME Offer โ
Ask about AINNA pages, services and articles.
AINNA sources only ยท up to 5 lines ยท 20 questions/hour
No section data available yet.
Sites with documented sections will appear here.
We value your privacy
We use browser storage to remember your choice. Optional analytics runs only after you allow it; your choice is recorded with an anonymous ID. Privacy Policy