, when mixed with analytics merchandise, can rework into highly effective instruments for provide chain optimisation.
In manufacturing, the actual problem will not be producing items, however deciding when and the way a lot to provide.
This quote is from a plant director who contacted us for the implementation of an algorithm to enhance their Grasp Manufacturing Schedule (MPS).

The target was to generate manufacturing schedules that stability economies of scale with minimal stock.
Our preliminary resolution was a internet utility related to the manufacturing facility methods.

Whereas it generated optimum manufacturing plans, it nonetheless required planners to navigate dashboards and export outcomes.
Easy methods to enhance the consumer expertise with an AI layer on prime?
As an experiment, we packaged the optimisation engine right into a FastAPI microservice embedded inside an AI workflow constructed utilizing n8n.
The device advanced into an AI assistant (built-in within the planners’ workflow) that may perceive inputs, run the algorithm and ship optimised plans with explanations in plain English.

On this article, I current how we performed this experiment of utilizing AI Brokers for Provide Chain Optimisation with n8n.
This would be the first of a protracted collection of experiments making an attempt to construct a Provide Chain Optimisation “super-agent” geared up with algorithms packaged in FastAPI microservices.
Manufacturing Planning with Python
State of affairs
Allow us to assume that we’re supporting a medium-sized manufacturing facility in Europe.
The grasp manufacturing schedule is the first communication device between the industrial group and manufacturing.
In our shopper’s manufacturing facility, clients ship buy orders (PO) with portions and anticipated supply dates to their planning group.

For instance,
- Anticipated supply amount in
Month 2
is150 packing containers
Preliminary Resolution
The target of the planning group is to search out the optimum manufacturing plan to minimise manufacturing prices, contemplating:
- Setup Prices: fastened prices you’ve gotten every time you arrange a manufacturing line
Instance: 500 $ per manufacturing batch - Holding Prices: price of storage per unit per time
Instance: 1 $/unit/month
If you produce solely the amount wanted per thirty days, you possibly can minimise the holding prices.

However setup prices will explode as you must arrange the manufacturing line 12 instances.
Quite the opposite, should you produce the whole amount within the first month, you’ll solely have one setup, however your holding prices will explode.

You construct a list of two,000 packing containers within the first month, which will likely be slowly consumed over the 12 months.
There may be an optimum state of affairs between these two edge instances.
Easy methods to discover the fitting stability?
In one other article, I clarify the right way to use the Wagner-Inside algorithm to generate an optimised plan.
It is a dynamic programming methodology for manufacturing planning that finds the cost-optimal schedule over a number of durations.

It finds one of the best stability between setup and holding prices by evaluating all possible manufacturing plans.

The output is an optimum plan:
- 4 months (solely) of productions: Month 1, 6, 9 and 11 ;
- The stock is consumed between every manufacturing batch.
Within the animated GIF under, you possibly can visualise a demo of the deployed resolution on an internet utility.

Customers can
- Add their demand forecasts per thirty days, week or day
- Choose the parameters (setup prices, holding prices, …)
Can we enhance the consumer expertise with the assist of AI?
To enhance the productiveness of planners, we purpose to eradicate the UI and instantly combine the answer into their workflow utilizing AI.
Within the subsequent part, I’ll share the experiments we performed utilizing a prototype of this AI-powered workflow constructed with n8n.
👉 Verify the video linked under for a stay demo of the workflow
AI Workflow with FastAPI and n8n
From the suggestions obtained throughout the Person Acceptance Checks (UAT), we understood that they would want the device to be higher built-in into their present processes and workflows.
AI Brokers geared up with instruments
The planning optimisation algorithm has been packaged in a FastAPI backend with a number of endpoints
- /upload_prod: this endpoint receives a POST request with the demand dataset included to add it to the backend
- /launch_plan: this endpoint receives a GET request with parameters like setup price, holding price, and time unit

Easy methods to join this backend with an AI Agent?
We are going to use an AI Agent node in n8n, geared up with a device node that may ship and obtain HTTP requests.

For all usages, the structure of this AI Agent node will likely be similar:
- Giant Language Mannequin: Within the instance above, we use an OpenAI mannequin
- HTTP request node with a system message that explains how to hook up with the API and what kind of knowledge to anticipate as outputs
This node will likely be used to generate a abstract of the optimum manufacturing plan, which will likely be despatched through e-mail.
AI Workflow: Automated Electronic mail Reply
Manufacturing planners usually obtain their requests from the industrial group through e-mail, which incorporates particulars within the physique and requested volumes by interval within the attachment.

They wished to robotically reply these requests with out manually downloading the attachment, importing it to the UI and producing an e-mail based mostly on the outcomes proven within the UI.
It has been agreed with them that they’ll observe a selected format of emails to make sure that all data required is included:
- Attachment: demand dataset in (.csv) format
- Electronic mail physique: all of the parameters wanted, like holding prices, setup prices, forex

The AI Agent offered earlier than will obtain information from one other agent that may parse the e-mail to extract the related parameters.

Step 1: Accumulate Electronic mail and Obtain the Attachment
The Gmail set off node collects the e-mail physique and downloads the attachment.

The (.csv) file is transformed into JSON and despatched through POST request to the backend.
Now that the dataset is uploaded, we will present the e-mail physique to the primary AI Agent node.
Step 2: Producing the Optimum Manufacturing Plan
We’ve two AI agent nodes on this workflow
- The AI Agent Parser parses the e-mail content material to extract the parameters, which are returned in JSON format.
- The AI Agent API Request ingests these parameters and queries the FastAPI backend to retrieve the outputs used to generate the written evaluation.

Within the system immediate of the primary AI Agent node, we element the right way to parse the e-mail to gather the right parameters.

The outputs of this AI Agent Parser are despatched to the second AI Agent that may question the backend.

In a minimal system immediate, we instruct the AI Agent API Request on the right way to use the device.
We offer an summary of the parameters obtainable:

We checklist the outputs of the API’s endpoint:

We element the duty anticipated:

The output of the second agent is distributed again to the industrial group through e-mail utilizing the final Gmail node.

The abstract consists of the minimal set of data (prices, manufacturing batches) wanted by the industrial to offer a citation to the shopper.
Conclusion
This workflow has been deployed as a POC with two customers who supplied encouraging suggestions.
We’re searching for enterprise instances to productize this strategy and suggest the function for all our analytics merchandise.
Up to now, it has been determined that this function could be used for orders with non-critical gadgets.
AI Workflows as enablers
Primarily based on my expertise in designing and implementing analytics merchandise, the first impediment to the fast adoption of a device is its integration into current processes and workflows.
For product planners who handle 100+ references with dozens of consumers and inner stakeholders, it’s preferable to keep away from studying a brand new device with a selected interface and extra guide steps.
Subsequently, AI brokers will be utilised to combine a device into any current workflow with minimal impression and extra workload for customers.
With the assist of n8n, we’ve experimented with integrating our analytics merchandise with Jira for workforce planning, in addition to utilising Telegram for transportation routing and ERP modules utilized by our clients.
What’s subsequent?
This workflow will be enhanced to leverage the complete potential of huge language fashions (LLMs).
As an example, we will ask the brokers to simulate a number of situations of volumes to advise the shopper on whether or not to extend or scale back their ordered amount to acquire a greater value.
So long as we’ve defined to the agent the right way to use the device (i.e., our analytic product, packaged in a FastAPI microservice), we will work with it as if we’ve an analyst who can run situations.
About Me
Let’s join on Linkedin and Twitter. I’m a Provide Chain Engineer who makes use of information analytics to enhance logistics operations and scale back prices.
For consulting or recommendation on analytics and sustainable provide chain transformation, be happy to contact me through Logigreen Consulting.
In case you are serious about Information Analytics and Provide Chain, take a look at my web site.