artificial-intelligence

Most People Are Using AI Agents Wrong. Here’s The Fix.

It was Tuesday at 11:30 PM. I was staring at a “Master Production Schedule” that looked like a crime scene of VLOOKUPs. My LinkedIn feed earlier that day was clogged with posts about how AI is “revolutionizing supply chains.” Some 22-year-old “AI Whisperer” claimed they automated their entire logistics network with one prompt.

I wanted to scream.

I had spent the last three hours trying to get ChatGPT to reconcile our Q4 production targets against raw material availability. It was a disaster. It hallucinated inventory levels that didn’t exist. It confused “lead time” with “transit time.” It confidently told me we had enough chipsets to run the line for three weeks when the warehouse was actually empty.

The hype felt like a scam. I was a Senior Data Analyst. I knew my way around Python and SQL. If I couldn’t make this work, how was the floor manager supposed to do it? I closed my laptop in disgust. The old way — manually cross-referencing three different ERP exports and a stack of emails from suppliers — was painfully slow. But at least it didn’t lie to me.

The Failure of the “Do It All” Chatbot

The problem wasn’t the technology. It was my expectation. I bought the lie.

I was treating AI like a seasoned Operations Manager. I gave it a giant, messy pile of work — demand forecasts, inventory lists, supplier PDFs — and said, “Figure this out.”

AI LLMs (Large Language Models) are amazing. But they are not smart in the way a human is smart. They lack context. They have zero long-term memory. They are eager to please, which means they will lie to you rather than admit they don’t know something.

When you ask one chatbot to read a demand plan, check current stock, calculate burn rates, and flag shortages all in one go, you are setting it up to fail. It gets confused. It loses the thread. It’s like asking an intern on their first day to negotiate a contract with a Tier 1 supplier.

That night, I realized the “agentic future” everyone is yelling about isn’t one super-bot. It’s a lot of really dumb bots chained together.

The Fix: The Lazy Man’s Assembly Line

I stopped trying to find the perfect “mega-prompt.” I started thinking like a factory foreman.

If I have a complex task, I don’t give it to one person. I break it down into stupidly simple steps. Step A does one thing. Step B takes what Step A did and does the next thing.

This is what “AI Agents” actually are in practice. They aren’t autonomous digital employees. They are rigid workflows where an LLM handles the fuzzy bits in the middle.

I decided to tackle a different hated task: the Daily Shortage Report. Every morning, I had to download the “Open Orders” report, compare it to the “In-Transit” report from our freight forwarder, and highlight any SKUs that were going to be late. It took 45 minutes of brain-numbing row matching.

I didn’t try to build a grand “Autonomous Supply Chain Brain.” I built three tiny, stupid agents using Python.

Building your own AI Agent

Image generated by Gemini

The “Magic” (The Ugly Code)

Here is the actual framework. I use Python because it connects everything.

I created an “assembly line” of three separate scripts. They don’t talk to each other. They just pass data down the line.

Agent 1: The Fetcher (No AI here) This script is the grunt. It doesn’t think. It just opens the CSV files from our ERP and the Freight Forwarder. If you can write an Excel formula, you can understand this.

import pandas as pd

# Agent 1: The Fetcher
# Job: Get the raw data. Don't ask questions.

def fetch_data():
    print("Agent 1: Loading the mess...")
    
    # Load your ERP export
    orders = pd.read_csv('ERP_Open_Orders.csv')
    
    # Load the report the freight forwarder emailed you
    freight = pd.read_csv('Freight_Status.csv')
    
    return orders, freight

# That's it. It just grabs the boxes.

Agent 2: The Comparator (No AI here either) This is the logic layer. This is where 90% of the work happens. We don’t need AI to compare dates. We need math. This script merges the tables and filters for problems.

# Agent 2: The Comparator
# Job: Find the problems using cold, hard logic.

def find_delays(orders, freight):
    print("Agent 2: Crunching numbers...")
    
    # Merge the tables based on PO Number
    merged = pd.merge(orders, freight, on='PO_Number', how='left')
    
    # Convert text dates to actual date objects so Python can do math
    merged['Required_Date'] = pd.to_datetime(merged['Required_Date'])
    merged['Est_Arrival'] = pd.to_datetime(merged['Est_Arrival'])
    
    # The Logic: Is it arriving AFTER we need it?
    # We only want the rows where this is TRUE.
    delays = merged[merged['Est_Arrival'] > merged['Required_Date']].copy()
    
    # Calculate how late it is (in days)
    delays['Days_Late'] = (delays['Est_Arrival'] - delays['Required_Date']).dt.days
    
    return delays

# If this returns nothing, we stop. We don't wake up the AI.

Agent 3: The Summarizer (The AI part) This is the only part that costs money. It receives only the problematic rows from Agent 2. It has one specific job: Write the email draft. It doesn’t need to know about our budget or our 5-year plan. It just needs to yell at the supplier politely.

import openai

# Agent 3: The Summarizer
# Job: Write the email so I don't have to.

def draft_emails(delay_dataframe):
    print("Agent 3: Writing angry (but polite) emails...")
    
    # Loop through the delayed items
    for index, row in delay_dataframe.iterrows():
        
        supplier = row['Supplier_Name']
        po = row['PO_Number']
        days = row['Days_Late']
        
        # The Prompt Strategy: Rigid and Specific.
        system_prompt = """
        You are a supply chain expeditor. 
        Write a brief, firm email to a supplier about a delay.
        Reference the PO Number and the Delay Days specifically.
        Ask for an expedited shipping method at their expense.
        Do NOT be rude. Keep it under 100 words.
        """

        user_prompt = f"Supplier: {supplier}. PO: {po}. Late by: {days} days."

        # Call the "Intern"
        response = openai.ChatCompletion.create(
            model="gpt-4-turbo", 
            temperature=0.2, # Low creativity. We want consistency.
            messages=[
                {"role": "system", "content": system_prompt},
                {"role": "user", "content": user_prompt}
            ]
        )

        email_draft = response.choices[0].message.content
        
        print(f"--- Draft for {supplier} ---")
        print(email_draft)
        print("----------------------------")

Plain English Explanation

Think of this workflow like a receiving dock.

  • Agent 1 is the forklift driver. He doesn’t know what’s in the box. He just moves the pallet from the truck to the staging area.
  • Agent 2 is the guy with the clipboard. He checks the label against the manifest. If it matches, he ignores it. If the dates are wrong, he slaps a red sticker on it. That’s it.
  • Agent 3 is the expeditor who walks over only when they see a red sticker. They don’t check every box. They just deal with the problem cases that the clipboard guy found.

By limiting the AI to just that final, narrow step, I removed 95% of the opportunity for it to hallucinate. It doesn’t need to calculate lead times. It doesn’t need to know the whole schedule. It just needs to write an email about three specific delayed parts.

The Insight

The hype around AI agents tells you to think big. I am telling you to think small. Exceptionally small.

If you are drowning in S&OP spreadsheets, stop waiting for an AGI savior. Stop trying to replace your whole job. You have judgment and context about supplier relationships that AI doesn’t have.

Start trying to clone the dumbest 10% of your day. The parts that require eyeballs but zero brainpower. Be the architect of an assembly line, not the guy sweating on the factory floor trying to do it all with one hammer.

My shortage monitor runs at 6:00 AM automatically. When I open my laptop at 8:30 AM, I have three draft emails ready to send to suppliers. I drink my coffee. I don’t panic. It’s not revolutionary. But it gave me my mornings back.

Image generated by Gemini