, when mixed with analytics merchandise, can remodel into highly effective instruments for provide chain optimisation.
In manufacturing, the actual problem isn’t producing items, however deciding when and the way a lot to supply.
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 steadiness economies of scale with minimal stock.
Our preliminary resolution was a net software related to the manufacturing facility techniques.

Whereas it generated optimum manufacturing plans, it nonetheless required planners to navigate dashboards and export outcomes.
enhance the person expertise with an AI layer on high?
As an experiment, we packaged the optimisation engine right into a FastAPI microservice embedded inside an AI workflow constructed utilizing n8n.
The software 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” outfitted 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 software between the industrial crew and manufacturing.
In our consumer’s manufacturing facility, clients ship buy orders (PO) with portions and anticipated supply dates to their planning crew.
For instance,
- Anticipated supply amount in
Month 2
is150 bins
Preliminary Answer
The target of the planning crew is to search out the optimum manufacturing plan to minimise manufacturing prices, contemplating:
- Setup Prices: fastened prices you’ve every time you arrange a manufacturing line
Instance: 500 $ per manufacturing batch - Holding Prices: value of storage per unit per time
Instance: 1 $/unit/month
If you produce solely the amount wanted per 30 days, you possibly can minimise the holding prices.

However setup prices will explode as it’s important to arrange the manufacturing line 12 occasions.
Quite the opposite, if you happen to 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 bins within the first month, which might be slowly consumed over the 12 months.
There’s an optimum state of affairs between these two edge instances.
discover the fitting steadiness?
In another article, I clarify the best way to use the Wagner-Inside algorithm to generate an optimised plan.
It is a dynamic programming technique for manufacturing planning that finds the cost-optimal schedule over a number of durations.

It finds the most effective steadiness 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 beneath, you possibly can visualise a demo of the deployed resolution on an online software.
Customers can
- Add their demand forecasts per 30 days, week or day
- Choose the parameters (setup prices, holding prices, …)
Can we enhance the person expertise with the help of AI?
To enhance the productiveness of planners, we goal 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.
👉 Examine the video linked beneath for a dwell demo of the workflow
AI Workflow with FastAPI and n8n
From the suggestions obtained through the Person Acceptance Exams (UAT), we understood that they would want the software to be higher built-in into their present processes and workflows.
AI Brokers outfitted 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 value, holding value, and time unit

join this backend with an AI Agent?
We’ll use an AI Agent node in n8n, outfitted with a software node that may ship and obtain HTTP requests.

For all usages, the structure of this AI Agent node might 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 information to count on as outputs
This node might be used to generate a abstract of the optimum manufacturing plan, which might be despatched through e mail.
AI Workflow: Automated Electronic mail Reply
Manufacturing planners usually obtain their requests from the industrial crew through e mail, which incorporates particulars within the physique and requested volumes by interval within the attachment.

They wished to routinely reply these requests with out manually downloading the attachment, importing it to the UI and producing an e mail primarily based 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 info required is included:
- Attachment: demand dataset in (.csv) format
- Electronic mail physique: all of the parameters wanted, like holding prices, setup prices, foreign money

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: Acquire 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 have now 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 best way to parse the e-mail to gather the correct 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 best way to use the software.
We offer an summary of the parameters out there:

We checklist the outputs of the API’s endpoint:

We element the duty anticipated:

The output of the second agent is shipped again to the industrial crew 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 supply a citation to the shopper.
Conclusion
This workflow has been deployed as a POC with two customers who offered encouraging suggestions.
We’re on the lookout for enterprise instances to productize this strategy and suggest the function for all our analytics merchandise.
Thus far, it has been determined that this function can be used for orders with non-critical objects.
AI Workflows as enablers
Primarily based on my expertise in designing and implementing analytics merchandise, the first impediment to the fast adoption of a software is its integration into present processes and workflows.
For product planners who handle 100+ references with dozens of consumers and inside stakeholders, it’s preferable to keep away from studying a brand new software with a selected interface and extra guide steps.
Due to this fact, AI brokers could be utilised to combine a software into any present workflow with minimal impression and extra workload for customers.
With the help of n8n, we’ve got 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 could be enhanced to leverage the complete potential of enormous 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 got defined to the agent the best way to use the software (i.e., our analytic product, packaged in a FastAPI microservice), we will work with it as if we’ve got 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 eager about Information Analytics and Provide Chain, take a look at my web site.