আজ আসুন একটি পূর্বনির্ধারিত টুলবক্স থেকে টুল নির্বাচন করার সময় একাধিক এজেন্ট কিভাবে সমন্বয় করে তার উপর ফোকাস করা যাক। কার্যকরী হওয়া সত্ত্বেও, এই নকশাটি স্পষ্টভাবে অনুমান করে যে একটি কাজের জন্য প্রয়োজনীয় সরঞ্জামগুলি আগে থেকেই পরিচিত।
আসুন এই নিবন্ধে সেই ধারণাটিকে চ্যালেঞ্জ করি।
আধুনিক এলএলএমগুলি ইতিমধ্যে জটিল লক্ষ্যগুলির জন্য বহু-পদক্ষেপের পরিকল্পনা তৈরি করতে পারে, কার্যকর করার আদেশ সম্পর্কে কারণ এবং সঠিক, কার্যকরী কোড তৈরি করতে পারে। অন্য কথায়, তারা ঠিক করে না ব্যবহার করুন সরঞ্জাম – তারা পারে তাদের তৈরি করুন.
এই নিবন্ধটি একটি ব্যবহার করে অনুসন্ধান পরিকল্পনা-কোড-এজেন্টিক আর্কিটেকচার চালান এন্ড-টু-এন্ড তৈরি করতে স্পষ্টীকরণ এজেন্টএকটি বাস্তব-বিশ্বের দৃশ্যের মাধ্যমে চিত্রিত করা হয়েছে যেখানে চাহিদা অনুযায়ী সরঞ্জাম তৈরি করা হয়।

এখানে প্রস্তাবিত স্থাপত্যটি অন্যান্য পরিস্থিতিতেও সহজেই মানিয়ে নেওয়া যায়।
ল্যান্ডস্কেপ
চাহিদার পূর্বাভাসের জন্য আমরা গ্রাফ নিউরাল নেটওয়ার্ক (GNN) মডেলের ফলাফল ব্যাখ্যা করব, যা আমি আমার আগের নিবন্ধে অন্বেষণ করেছি। ব্যাখ্যা করার জন্য আমাদের কাছে নিম্নলিখিত ডেটা সংকেত রয়েছে:
- নোডের স্থানিক বৈশিষ্ট্য (SKUs)।
- গ্রাফ নোডগুলিতে অস্থায়ী বৈশিষ্ট্য (বিক্রয় আদেশ, উৎপাদন, ইত্যাদি) যোগ করা হয়েছে।
- একটি থেকে ফলাফল গ্রাফ নিউরাল নেটওয়ার্ক মডেল SKU চাহিদার পূর্বাভাস দেওয়ার জন্য প্রশিক্ষিত।
- উৎপাদনে অসঙ্গতি সনাক্ত করতে প্রশিক্ষিত একটি GNN-এর ফলাফল।
এই সমস্ত বিশ্লেষণ, ফলাফল এবং চার্টের একটি সিরিজ তৈরি করে যেগুলিকে একটি পরিকল্পনাকারীর দৃষ্টিকোণ থেকে, তথ্য এবং ডোমেন বোঝার উপর ভিত্তি করে সামগ্রিকভাবে ব্যাখ্যা করা দরকার।
ব্যাখ্যা এজেন্ট আর্কিটেকচার
আমরা একটি প্ল্যান-কোড-এজেন্টিক ওয়ার্কফ্লো তৈরি করব। দানাদার নিয়ন্ত্রণ, ব্যাখ্যাযোগ্যতা এবং টুল তৈরিতে নমনীয়তার জন্য, আমরা সুপরিচিত অর্কেস্ট্রেশন ফ্রেমওয়ার্কগুলির একটি থেকে বিমূর্ততার মাধ্যমে কাজ করার পরিবর্তে সম্পূর্ণ কাস্টম এজেন্ট তৈরি করব। নিম্নলিখিত এজেন্ট তৈরি করা হয়েছে:
1. বিশ্লেষক এজেন্ট
অ্যাপ্লিকেশন নিরীক্ষণ করার জন্য আমাদের একজন বিশ্লেষক এজেন্ট প্রয়োজন। এর কাজ আবিষ্কার পরিবেশ (কাঁচা তথ্য, মডেল ফলাফল, অতীত আউটপুট) যা বাকি অ্যাপ্লিকেশন ব্যবহার করবে। এটি হ্যালুসিনেশন প্রতিরোধ করে যেমন প্ল্যানিং এজেন্ট বিশ্বাস করে যে বিক্রয় ফাইলটির নাম দেওয়া হয়েছে “sales.csv” ফাইলের নাম সঠিক হলে “Sales Order.csv” ডেটাসেটে।
সেখানে যা আছে তা স্ক্যান করার পাশাপাশি, এটি ফাইলগুলিও খোলে এবং একটি গতিশীল স্কিমা তৈরি করে। যেমন, Sales Order.csv কলাম হয় [Date, Amount] এবং demand_vs_production.csv হল [Predicted, Actual]. এটি পরিকল্পনা এজেন্টের জন্য প্রসঙ্গ তৈরি করে।
2. পরিকল্পনাকারী
পরিকল্পনাকারী ব্যবহারকারীর উচ্চ-স্তরের লক্ষ্য এবং বিশ্লেষকের স্কিমা ক্যাপচার করে। এটি অ্যাপ্লিকেশনের মস্তিষ্ক হিসাবে কাজ করে। এর কাজ দ্রবীভূত করা পর্যায়গুলির নির্ভরতা গ্রাফে অনুরোধ। এটি করার জন্য, এটি প্রথমে ব্যবহারকারীর অনুরোধ থেকে অভিপ্রায় অনুমান করে। ব্যবহারকারী যদি “নির্ভুলতা” জিজ্ঞাসা করেন, তাহলে তিনি জানেন কিভাবে লক্ষ্য রাখতে হয় Forecast Results ফোল্ডার যদি তারা “বিক্রয় ইতিহাস” জিজ্ঞাসা করে তবে এটি লক্ষ্যবস্তু। Raw Data. আউটপুট হল একটি JSON প্ল্যান যার ধাপগুলি স্পষ্টভাবে টাস্কের সাথে সাথে কোড বা টেক্সট নামে একটি পতাকা বর্ণনা করে। শুধুমাত্র কোড ধাপের জন্য কোডার এজেন্ট দ্বারা টুল তৈরি করা হয়।
নমুনা আউটপুট: একটি JSON স্কিম।
- ধাপ 1: গ্রাফ ডেটা লোড করুন এবং SOS001L12P এর প্রতিবেশীদের খুঁজুন। (কোড)
- ধাপ 2: সামগ্রিক অস্থায়ী বিক্রয় বনাম উৎপাদন। (কোড)
- ধাপ 3: WAPE গণনা করুন। (কোড)
- ধাপ 4: সারাংশ প্রস্তুত করুন (পাঠ্য)
3. কোডার
কোডার হল অ্যাপ্লিকেশনের হাত, যা বেশিরভাগ কাজ করে। কোডার প্রতিটি পদক্ষেপ পরিকল্পনা এবং স্কিমা থেকে উদ্ভূত। প্রতিটি পরিকল্পনা কোড ধাপের জন্য, আমিt লেখেন a স্বতন্ত্র, এক্সিকিউটেবল পাইথন স্ক্রিপ্ট.
এই লাইব্রেরি আমদানি পরিচালনা করে (pandas, networkx), পরম পথ, এবং ত্রুটি ধরা। এটি শুধুমাত্র কোড স্নিপেট নয়, স্বয়ংসম্পূর্ণ সফ্টওয়্যার তৈরি করে।
4. নির্বাহক
নির্বাহক একটি নিয়ন্ত্রিত পরিবেশে উত্পন্ন স্ক্রিপ্ট চালায়। এটি করার জন্য, এটি ক্যাপচার করে stdout এবং stderr. যদি একটি স্ক্রিপ্ট ব্যর্থ হয় (যেমন, FileNotFound), লগগুলি সম্ভাব্য স্ব-সংশোধনের জন্য একটি প্রতিক্রিয়া লুপ প্রদান করে (যদিও এটি বিশ্লেষকের স্কিমা দ্বারা প্রদত্ত গ্রাউন্ডিংয়ের কারণে ঘটে না)।
5. রিপোর্টার
শেষ পর্যন্ত রিপোর্টার স্ক্রিপ্ট দ্বারা উত্পাদিত লগ এবং আর্টিফ্যাক্ট (CSV, PNG) পড়ে এবং ব্যবহারকারীর প্রয়োজনীয় স্বন, গভীরতা এবং ব্যক্তিত্বে ব্যবহারকারীর আসল প্রশ্নের উত্তর দেয়। এটি অ্যাপ্লিকেশনের ভয়েস হিসাবে কাজ করে।
একটি সাধারণ অর্কেস্ট্রেশন স্ক্রিপ্ট (main.py) ক config.py এতে নোড এবং প্রান্ত সম্পর্কে তথ্য সম্বলিত ডেটাসেট ফোল্ডারের পথ এবং চাহিদা পূর্বাভাস এবং উত্পাদন অসঙ্গতি সনাক্তকরণ মডেলগুলির ফলাফল ফোল্ডার অন্তর্ভুক্ত রয়েছে। প্রতিটি এজেন্ট এবং অর্কেস্ট্রেশন স্ক্রিপ্ট কোডের 100 লাইনের কম। এলএলএম ব্যবহার করা হয় মিথুন-2.5-ফ্ল্যাশ.
পরীক্ষার সময় প্রধান ত্রুটিগুলি ছিল কোডার এজেন্ট একটি ডেটা উত্স উল্লেখ করে যা বিদ্যমান নেই (হ্যালুসিনেশন), যার জন্য আমি পরিকল্পনা পর্বের প্রসঙ্গটি কঠোরভাবে অনুসরণ করার জন্য কোডার প্রম্পটকে শক্তিশালী করেছি। তদ্ব্যতীত, বিশ্লেষক এজেন্ট প্রাথমিকভাবে সেখানে ছিল না, এবং হ্যালুসিনেশন প্রতিরোধে পরিকল্পনাকারীর আগে একটি গুরুত্বপূর্ণ পদক্ষেপ হিসাবে যুক্ত করা হয়েছিল।
এখানে এটা পরিকল্পনাকারী এজেন্ট কোড রেফারেন্সের জন্য
import json
from ..llm.client import GeminiClient
class Planner:
def __init__(self):
self.llm = GeminiClient()
def create_plan(self, user_prompt, dataset_context=""):
"""Decomposes user prompt into execution steps."""
system_prompt = f"""
You are a Senior Project Manager for a Data Science team.
Your goal is to break down a high-level user request into a list of specific, executable steps.
--- DATASET AVAILABLE (Use EXACT Filenames) ---
{dataset_context}
-----------------------------------------------
--- DATASET GUIDELINES ---
- The dataset contains both 'Raw Data' (Historical) and 'Model Results' (Predictions/Anomalies).
- CAREFULLY infer which source is needed based on the user's goal.
- Example: "Sales Analysis" -> Raw Data. "Forecast Accuracy" -> Model Results.
Output format: JSON list of objects with fields:
- step_id: int
- name: str (short title)
- description: str (detailed instruction for the coder)
- type: "CODE" (if it requires writing a script) or "TEXT" (if just a summary)
--- SCOPE RESTRICTION ---
- DO NOT USE Machine Learning (LinearRegression, Training, Random Forest).
- USE ONLY Statistical Analysis (Mean, Median, Std Dev, Z-Score, Rolling Averages).
- FOCUS on Data Visualization (Line plots, Histograms).
- If the user asks for "forecast" or "accuracy", PREFER WAPE (Weighted MAPE) over standard MAPE.
Example:
User: "Analyze SKU001"
Output:
[
{{"step_id": 1, "name": "Load Data", "description": "Load Nodes.csv and filter for SKU001 to get basic info.", "type": "CODE"}},
{{"step_id": 2, "name": "Temporal Analysis", "description": "Load Production.csv and Sales.csv. Calculate monthly volume and trend for SKU001.", "type": "CODE"}}
]
"""
full_prompt = f"{system_prompt}\n\nUser Request: {user_prompt}\nJSON Plan:"
response = self.llm.generate_content(full_prompt)
# basic cleanup for JSON markdown blocks
clean_response = response.replace("```json", "").replace("```", "").strip()
print(f"\n[DEBUG] Raw Planner Response:\n{response}\n") # Added for debugging
try:
return json.loads(clean_response)
except json.JSONDecodeError:
print(f"Failed to parse plan: {response}")
return []
পরীক্ষার ফলাফল
আমরা SKU-এর জন্য এন্ড-টু-এন্ড ব্যাখ্যার উপর ফোকাস করব SOS001L12P. এটি সর্বাধিক বিক্রয় ভলিউম সহ নোড। চাহিদা মেটাতে এবং পরিষেবার গুণমান বজায় রাখার জন্য পরিকল্পনাকারী এবং ব্যবস্থাপনা প্রাথমিকভাবে সমস্যাগুলি বুঝতে আগ্রহী হবে।
আমরা 4টি ধাপে ব্যাখ্যাযোগ্যতা তৈরি করব:
- সরবরাহ নেটওয়ার্কে প্রতিবেশীদের সাথে এই SKU-এর ভাগ করা সম্পর্ক বিশ্লেষণ করুন।
- বিক্রয় ভলিউম প্রবণতা বিশ্লেষণ.
- আউটপুট সংকেতের সাথে সম্পর্কযুক্ত করুন, অসঙ্গতিগুলি নোট করুন।
- এই SKU এর স্বাস্থ্য ব্যাখ্যা করার জন্য মানের সাথে চাহিদার পূর্বাভাস একত্রিত করে একটি ব্যাপক প্রতিবেদন তৈরি করুন।
স্থানিক বিশ্লেষণ
এজেন্টের জন্য নির্ধারিত লক্ষ্য ছিল
“নোড SOS001L12P এর চারপাশে স্থানিক কাঠামোর একটি পুঙ্খানুপুঙ্খ বিশ্লেষণ করুন এবং আমাকে গ্রাফটির একটি দৃশ্য দিন
লেবেলযুক্ত প্রান্তগুলি এই SKU কে এর প্রতিবেশীদের সাথে সংযুক্ত করছে”
প্ল্যানার এজেন্ট নোড এবং প্রান্ত ডেটা লোড করতে, প্রতিবেশী এবং প্রান্ত বৈশিষ্ট্যগুলি বের করতে, লেবেলগুলির সাথে একটি গ্রাফ ভিজ্যুয়ালাইজেশন তৈরি করতে এবং স্থানিক কাঠামোর জন্য একটি প্রতিবেদন তৈরি করতে একটি 5-পদক্ষেপ পরিকল্পনা তৈরি করেছে৷
এখানে পরিকল্পনা
[
{
"step_id": 1,
"name": "Load Node and Edge Data",
"description": "Load 'Nodes.csv' to confirm 'SOS001L12P' as a valid node. Load all edge datasets: 'Edges (Plant).csv', 'Edges (Product Group).csv', 'Edges (Product Sub-Group).csv', and 'Edges (Storage Location).csv'. These files contain the structural information needed for spatial analysis.",
"type": "CODE"
},
{
"step_id": 2,
"name": "Extract Direct Neighbors and Edge Attributes",
"description": "Iterate through each loaded edge dataset. For each dataset, filter rows where 'SOS001L12P' is present in either the 'node1' or 'node2' column. For each matching record, identify the neighboring node and extract the specific edge attribute that defines the relationship (e.g., 'Plant' from 'Edges (Plant).csv', 'GroupCode' from 'Edges (Product Group).csv', 'SubGroupCode' from 'Edges (Product Sub-Group).csv', 'Storage Location' from 'Edges (Storage Location).csv'). Consolidate all unique neighbors and their corresponding labeled relationships into a single structure.",
"type": "CODE"
},
{
"step_id": 3,
"name": "Prepare Graph for Visualization",
"description": "Construct a graph object (e.g., using NetworkX) with 'SOS001L12P' as the central node. Add all identified direct neighbors as nodes and create edges between 'SOS001L12P' and each neighbor. Assign the extracted edge attributes (e.g., 'Plant: Plant A', 'GroupCode: GRP1') as labels to these edges for clarity in the visualization.",
"type": "CODE"
},
{
"step_id": 4,
"name": "Visualize Graph Edges with Labels",
"description": "Generate a clear graph visualization of the spatial structure around 'SOS001L12P'. The plot should display 'SOS001L12P' prominently in the center, with its direct neighbors connected by edges. Each edge must be explicitly labeled with the type of relationship and its specific attribute value (e.g., 'Plant: P001', 'Product Group: PG002'). Ensure appropriate layout and styling for readability.",
"type": "CODE"
},
{
"step_id": 5,
"name": "Summarize Spatial Connectivity",
"description": "Provide a textual summary of the spatial structure around 'SOS001L12P'. Describe the types of entities it is connected to (Plants, Product Groups, Product Sub-Groups, Storage Locations), list the specific neighbors identified, and briefly explain the nature of these connections based on the edge labels.",
"type": "TEXT"
}
]
কোডার এজেন্ট 4টি টুল তৈরি করেছে, প্রতিটি কোড ধাপের জন্য একটি

এবং প্রাথমিক আউটপুট হল এই SKU এর প্রতিবেশীদের সাথে সম্পর্কের একটি গ্রাফ, সমস্ত লেবেলযুক্ত সম্পর্কের সাথে, যেমন শেয়ার্ড প্ল্যান্ট, স্টোরেজ লোকেশন, প্রোডাক্ট গ্রুপ ইত্যাদি।

এবং ফলাফলগুলির একটি সংক্ষিপ্ত প্রতিবেদন প্রস্তুত করা হয়েছে যা নোট করে:
“প্রতিবেশী সম্পর্ক: বিশ্লেষণে 39টি ভিন্ন সংযোগকারী সম্পর্ক চিহ্নিত করা হয়েছে SOS001L12P 39টি অনন্য প্রতিবেশী নোডের জন্য।”
সম্পূর্ণ প্রতিবেদন এখানে
A thorough analysis of the spatial structure around node `SOS001L12P` has been completed.
**Analysis Findings:**
1. **Node Validation:** The node `SOS001L12P` was confirmed as a valid node within the master data.
2. **Neighbor Relationships:** The analysis identified 39 distinct relationships connecting `SOS001L12P` to 39 unique neighboring nodes. These relationships are categorized by `RelationshipType` and `RelationshipValue`:
* **Plant:** `SOS001L12P` is connected to multiple neighbors via various 'Plant' codes (e.g., 2103, 2111, 2112, 2114, 2115, 2116, 2117, 2118, 2119, 2120, 2121, 2122).
* **GroupCode:** `SOS001L12P` shares 'GroupCode' 'S' with neighbors like `SOS008L02P`, `SOS005L04P`, `SOS003L04P`, `SOS002L09P`, `SOS500M24P`, `SOS250M48P`, `SOP001L12P`, `SO0005L04P`, `SO0002L09P`, `SO0001L12P`, `SO0500M24P`, `SE500G24P`, and `SE200G24P`.
* **SubGroupCode:** `SOS001L12P` is linked by 'SubGroupCode' 'SOS' to nodes such as `SOS008L02P`, `SOS005L04P`, `SOS003L04P`, `SOS002L09P`, `SOS500M24P`, and `SOS250M48P`.
* **Storage Location:** `SOS001L12P` is associated with its neighbors through various 'Storage Location' codes (e.g., 330.0, 1130.0, 1230.0, 1430.0, 1530.0, 1630.0, 1730.0, 1830.0, 1930.0, 2030.0, 2130.0, 2230.0).
The full list of neighbors and their specific relationships can be found in `C:/Auto-agent/workspace/output\SOS001L12P_neighbors_relationships.csv`.
**Visualization:**
A graph visualization has been generated, centering on `SOS001L12P` and displaying all its direct neighbors and their connecting edges with labels indicating the `RelationshipType` and `RelationshipValue`. The resulting graph contains 40 nodes (including `SOS001L12P`) and 39 edges.
The visualization is available at: `C:/Auto-agent/workspace/output\SOS001L12P_neighbor_graph.png`
বিক্রয় আদেশ (চাহিদা) সংকেত বিশ্লেষণ
যেহেতু আমরা চাহিদার পূর্বাভাস মডেলের নির্ভুলতায় আগ্রহী, তাই বিক্রয় প্রবণতা বিশ্লেষণ করা গুরুত্বপূর্ণ। লক্ষ্য নির্ধারণ করা হয়েছিল:
“SOS001L12P-এর সেল অর্ডার টেম্পোরাল সিগন্যাল, প্রবণতা, আউটলিয়ার এবং ভলিউম ট্রেন্ডের যেকোনো অস্বাভাবিকতা লক্ষ্য করা বিশ্লেষণ করুন”
পরিকল্পক বিক্রয় ডেটা লোড এবং প্রক্রিয়া করার জন্য একটি 6-পদক্ষেপ পরিকল্পনা তৈরি করেছেন, 7-দিন এবং 30-দিনের রোলিং গড় তৈরি করতে, আউটলায়ারগুলি গণনা করতে, প্রবণতাগুলি কল্পনা করতে এবং একটি প্রতিবেদন তৈরি করেছেন৷
পরিকল্পনা এখানে
[
{
"step_id": 1,
"name": "Load Sales Order Data for SOS001L12P",
"description": "Load the 'Sales Order.csv' file from C:\\AnomalyGNN\\dataset\\Raw Dataset\\Temporal Data\\Unit\\Sales Order.csv. Focus on the 'Date' and 'SOS001L12P' columns, treating 'SOS001L12P' as the sales volume.",
"type": "CODE"
},
{
"step_id": 2,
"name": "Preprocess Temporal Data",
"description": "Convert the 'Date' column to datetime objects and set it as the DataFrame index. Ensure the sales volume column (SOS001L12P) is numerical. Handle any missing values, potentially by filling with 0 or forward/backward fill if appropriate for sales data (specify chosen method).",
"type": "CODE"
},
{
"step_id": 3,
"name": "Analyze Sales Volume Trends",
"description": "Calculate 7-day and 30-day rolling averages for the 'SOS001L12P' sales volume. These will help identify short-term and long-term trends in the sales signal. Store these as new columns in the DataFrame.",
"type": "CODE"
},
{
"step_id": 4,
"name": "Detect Outliers using Z-Score",
"description": "Calculate the Z-score for the 'SOS001L12P' sales volume. Identify potential outliers by marking data points where the absolute Z-score exceeds a predefined threshold (e.g., 2 or 3 standard deviations). Store the Z-score and an 'Is_Outlier' boolean column.",
"type": "CODE"
},
{
"step_id": 5,
"name": "Visualize Sales Order Temporal Signal",
"description": "Create a time-series line plot showing the 'SOS001L12P' sales volume over time. Overlay the 7-day and 30-day rolling averages. Highlight the identified outliers on the plot to visually represent abnormalities in volume trends.",
"type": "CODE"
},
{
"step_id": 6,
"name": "Summarize Trends and Abnormalities",
"description": "Provide a textual summary of the observed trends (e.g., seasonality, growth/decline), the frequency and magnitude of identified outliers, and any other notable abnormalities or shifts in the sales volume patterns for SOS001L12P. This summary should interpret the visualizations and statistical measures.",
"type": "TEXT"
}
]
কোডার এজেন্ট 5টি টুল তৈরি করেছে এবং পাইপলাইনের প্রাথমিক আউটপুট হল নিম্নলিখিত প্রবণতা। একটি উল্লেখযোগ্য পর্যবেক্ষণ সময়ের দ্বিতীয়ার্ধে একটি নিম্নগামী প্রবণতা উদ্বেগের কারণ হতে পারে যা তদন্ত করা উচিত।

বিশ্লেষণ প্রতিবেদনে এই পতনের প্রবণতাও উল্লেখ করা হয়েছে।
“অবিচলিত পতন: জানুয়ারী থেকে আগস্ট পর্যন্ত দৈনিক বিক্রয় এবং রোলিং গড় উভয় ক্ষেত্রেই ক্রমাগত হ্রাস (7-দিন এবং 30-দিন) স্পষ্টভাবে SOS001L12P-এর বিক্রয় পরিমাণে ক্রমাগত হ্রাস নির্দেশ করে।“
এখানে সম্পূর্ণ রিপোর্ট
**Analysis of SOS001L12P Sales Order Temporal Signal**
This analysis covers sales data for product SOS001L12P from January 1, 2023, to August 9, 2023.
**1. Volume Trend During the Duration:**
The sales volume for SOS001L12P shows a clear and persistent declining trend throughout the analyzed period.
* In early January 2023, daily sales volumes were high, with individual days reaching up to 21,394 units. The 30-day rolling average was approximately 12,629 by January 10th.
* By early August 2023, the sales volume had significantly decreased. The 30-day rolling average plummeted to approximately 5,165 by August 9th, indicating a substantial drop in consistent sales activity over the eight-month period.
**2. Persistent Declines and Other Issues:**
* **Persistent Decline:** The consistent decrease in both daily sales and the rolling averages (7-day and 30-day) from January to August clearly indicates a persistent decline in sales volume for SOS001L12P.
* **Anomalies:** The analysis identified 14 specific days classified as anomalies. These were characterized by unusually low sales volumes, either due to a Z-score below -2.0 or three consecutive days of negative percentage change. Notable severe drops include:
* January 4, 2023: Sales dropped to 10,920.08.
* March 8, 2023: Sales recorded an exceptionally low value of 200.00.
* **Zero Sales:** Towards the end of the analyzed period, there were instances of zero sales recorded (e.g., August 8th and 9th), further exacerbating the declining trend and highlighting critical issues in sales performance.
আউটপুট সংকেত বিশ্লেষণ
কেন বিক্রয় হ্রাস হতে পারে সে সম্পর্কে কোনো কার্যকারণ ইঙ্গিত আছে কিনা তা দেখতে উৎপাদনের অসঙ্গতির প্রতিবেদনগুলিকে সংযুক্ত করা গুরুত্বপূর্ণ। এটি করার জন্য, আমরা এজেন্টের জন্য নিম্নলিখিত লক্ষ্যগুলি সেট করি:
“SOS001L12P-এর আউটপুট টেম্পোরাল সিগন্যাল বিশ্লেষণ করুন, প্রবণতা, বহির্মুখী এবং ভলিউম প্রবণতার কোনো অস্বাভাবিকতা নির্দেশ করে“
বিক্রয় বিশ্লেষণের অনুরূপ একটি 7-পদক্ষেপ পরিকল্পনা প্রবণতা এবং বহির্মুখী গণনা করার জন্য তৈরি করা হয়েছিল অসঙ্গতি সনাক্তকরণ মডেল দ্বারা উত্পন্ন অসঙ্গতিগুলি কল্পনা করুন৷
এখানে পরিকল্পনা
[
{
"step_id": 1,
"name": "Load Production Data for SOS001L12P",
"description": "Load the 'Production .csv' file from 'C:\\AnomalyGNN\\dataset\\Raw Dataset\\Temporal Data\\Unit\\' into a pandas DataFrame. Select only the 'Date' and 'SOS001L12P' columns for analysis.",
"type": "CODE"
},
{
"step_id": 2,
"name": "Clean and Prepare Production Data",
"description": "Convert the 'Date' column to datetime objects and set it as the DataFrame index. Ensure the 'SOS001L12P' column is numeric. Handle any missing values in 'SOS001L12P' by filling with 0, assuming missing production data means zero units produced.",
"type": "CODE"
},
{
"step_id": 3,
"name": "Calculate Rolling Averages for Trend",
"description": "Compute a 7-day and a 30-day rolling average for the 'SOS001L12P' production volume. These rolling averages will help to visualize and identify short-term and long-term trends in the data.",
"type": "CODE"
},
{
"step_id": 4,
"name": "Visualize Production Volume and Trends",
"description": "Create a time series line plot showing the daily 'SOS001L12P' production volume. Overlay the 7-day and 30-day rolling averages on the same plot to visually represent the trend. Ensure proper labeling for axes and a clear title.",
"type": "CODE"
},
{
"step_id": 5,
"name": "Detect Outliers using Z-Score",
"description": "Calculate the Z-score for each data point in the 'SOS001L12P' production volume. Identify potential outliers by flagging data points where the absolute Z-score exceeds a predefined threshold (e.g., |Z-score| > 2.5 or 3). Store the dates and values of these outliers.",
"type": "CODE"
},
{
"step_id": 6,
"name": "Visualize Outliers and Abnormalities",
"description": "Generate a time series line plot of the 'SOS001L12P' production volume. On this plot, distinctly mark or color the data points that were identified as outliers in the previous step to highlight abnormalities in volume trends.",
"type": "CODE"
},
{
"step_id": 7,
"name": "Summarize Trend, Outliers, and Abnormalities",
"description": "Provide a textual summary of the observed overall trend (e.g., increasing, decreasing, stable, seasonal), describe the characteristics of the identified outliers (e.g., magnitude, frequency, specific dates), and comment on any notable abnormalities in the production volume patterns based on the visualizations and statistical analysis.",
"type": "TEXT"
}
]
উপযুক্ত সরঞ্জাম তৈরি করা হয়েছিল, কার্যকর করা হয়েছিল এবং আউটপুট তৈরি হয়েছিল। নিম্নলিখিত উত্পাদন প্রবণতা চার্ট এবং আরো গুরুত্বপূর্ণ, চার্টটি সময়ের দ্বিতীয়ার্ধে উল্লেখযোগ্য সংখ্যক অসঙ্গতি দেখাচ্ছে, যা বিক্রয়কে প্রভাবিত করতে পারে।


এটি তৈরি করা প্রতিবেদনে উল্লেখ করা হয়েছে:
“জেড-স্কোর আউটলারের অভাব সত্ত্বেও, একটি আরও পরিশীলিত অসঙ্গতি সনাক্তকরণ পদ্ধতি **17 অসামঞ্জস্যপূর্ণ ডেটা পয়েন্ট চিহ্নিত করা হয়েছে** SOS001L12P উৎপাদনে।“
সম্পূর্ণ প্রতিবেদন এখানে
Here's an analysis of the production temporal signal for SOS001L12P:
**1. Data Overview:**
The production data for SOS001L12P was successfully loaded and preprocessed, covering 221 days from January 1, 2023, to August 9, 2023. The 'Date' column was correctly parsed, and the 'SOS001L12P' production volume column was confirmed to be numeric with no missing values.
**2. Trend Analysis:**
* **Rolling Averages:** 7-day and 30-day rolling averages were computed to smooth out daily fluctuations and highlight underlying trends.
* The plot `SOS001L12P_production_trends.png` (saved to `C://Auto-agent/workspace/output`) visually represents the daily production volume alongside these rolling averages, allowing for observation of the overall temporal trend.
* Looking at the tail of the data, the 7-day and 30-day rolling averages show a general decline in production volume towards the end of the observed period (early August), with the 30-day average dropping from 5582.97 on August 7th to 5075.73 on August 9th, and the 7-day average dropping from 3724.71 to 2911.00 in the same period.
**3. Outliers (Z-score Method):**
* Using a Z-score threshold of |Z-score| > 2.5, **no potential outliers were identified** in the SOS001L12P production data. This suggests that while there might be variations, no individual data points significantly deviated from the mean (7480.90) by more than 2.5 standard deviations (4729.55).
**4. Abnormalities in Volume Trends:**
* Despite the lack of Z-score outliers, a more sophisticated anomaly detection method **identified 17 anomalous data points** in the SOS001L12P production.
* These anomalies are visualized in the plot `SOS001L12P_production_with_anomalies_plot.png` (saved to `C://Auto-agent/workspace/output`), which would highlight specific dates where production volume exhibited unusual behavior compared to its typical pattern. A significant drop to 0 on August 9th, for instance, is likely to be one such anomaly, suggesting a halt or severe reduction in production.
এন্ড-টু-এন্ড সাপ্লাই প্ল্যানার রিপোর্ট
এখন যেহেতু আমরা SKU SOS001L12P-তে স্থানিক-অস্থায়ী বিশ্লেষণ করেছি, পরবর্তী যৌক্তিক পদক্ষেপ হল অনুসন্ধানগুলিকে একটি চাহিদা পূর্বাভাস মডেলের সাথে সম্পর্কযুক্ত করা যাতে এটি প্রবণতাগুলির সাথে কীভাবে মানানসই হয়। এবং এই SKU স্বাস্থ্যের জন্য একটি সম্পূর্ণ প্রতিবেদন তৈরি করুন যা পরিকল্পক ব্যবস্থাপনায় নিতে পারে।
এটি করার জন্য, আমরা নিম্নলিখিত লক্ষ্যগুলি সেট করেছি:
“আমি একজন সাপ্লাই চেইন প্ল্যানার। আমি চাই আপনি অন্যান্য ডেটা সোর্সের সাথে সাম্প্রতিক অতীতের বিশ্লেষণ বিবেচনা করুন এবং SOS001L12P-তে একটি শেষ থেকে শেষ রিপোর্ট তৈরি করুন। আমি এই সময়ের দ্বিতীয়ার্ধে উৎপাদনের হ্রাস এবং সেই সময়কালে বেশ কিছু অসঙ্গতি লক্ষ্য করেছি। চাহিদার পূর্বাভাসের সাথে উৎপাদনের সম্পর্ক স্থাপন করুন এবং আমাদের পূর্বাভাস মডেলটি কীভাবে পারফর্ম করছে তার উপর মন্তব্য করুন।“
পরিকল্পক উত্পাদন, বিক্রয় এবং চাহিদার পূর্বাভাসগুলিকে সংযুক্ত করার জন্য একটি পরিকল্পনা তৈরি করেছেন, প্রাথমিক মেট্রিক WAPE (ভারিত পরম শতাংশ ত্রুটি) ব্যবহার করে পূর্বাভাস মডেলের কার্যকারিতা মূল্যায়ন করুন, তারপর একটি বিস্তৃত প্রতিবেদন তৈরি করুন।
এখানে পরিকল্পনা
[
{
"step_id": 1,
"name": "Load and Consolidate SOS001L12P Data",
"description": "Load the following datasets for SOS001L12P: \n1. Production rolling averages: C:\\Auto-agent\\workspace\\output\\production analysis - 2\\production_rolling_averages_SOS001L12P.csv (columns: Date, SOS001L12P, SOS001L12P_7_day_avg, SOS001L12P_30_day_avg)\n2. Production Z-Scores: C:\\Auto-agent\\workspace\\output\\production analysis - 2\\SOS001L12P_production_z_scores.csv (columns: Date, Actual_Production, Z_Score)\n3. Anomaly detection results: C:\\AnomalyGNN\\results\\top_sku_SOS001L12P_predictions.csv (columns: Date, Is_Anomaly)\n4. Demand vs. Production Forecast: C:\\GNN\\results\\demand_vs_production_SOS001L12P.csv (columns: Date, Predicted_Demand, Actual_Sales, Actual_Production)\n\nMerge all these dataframes on the 'Date' column, ensuring 'Date' is converted to a datetime format for accurate time-series analysis.",
"type": "CODE"
},
{
"step_id": 2,
"name": "Analyze and Visualize Production Trends and Anomalies",
"description": "Create a time-series line plot showing the 'Actual_Production' for SOS001L12P, overlaid with 'SOS001L12P_7_day_avg' and 'SOS001L12P_30_day_avg'. Highlight points where 'Is_Anomaly' is True (from top_sku_SOS001L12P_predictions.csv) or where 'Z_Score' exceeds a certain threshold (e.g., |Z_Score| > 2 or 3) to visually confirm the user's observation of a downward trend and anomalies in the second half of the duration. Identify the start date of the 'second half' based on the data's time range.",
"type": "CODE"
},
{
"step_id": 3,
"name": "Correlate Production, Sales, and Demand Forecast",
"description": "Generate a single time-series line plot comparing 'Actual_Production', 'Actual_Sales', and 'Predicted_Demand' for SOS001L12P. Analyze the visual correlation and note periods of significant divergence or alignment, especially during the identified 'second half' where production anomalies and downward trends were observed.",
"type": "CODE"
},
{
"step_id": 4,
"name": "Evaluate Forecasting Model Performance (WAPE)",
"description": "Calculate the Weighted Average Percentage Error (WAPE) for the 'Predicted_Demand' against 'Actual_Sales' for SOS001L12P using the consolidated data. Calculate WAPE for the entire duration and separately for the 'second half' of the duration (as identified in Step 2) to assess how the model performed during the period of observed production issues. Present the WAPE values and interpret their meaning regarding forecast accuracy.",
"type": "CODE"
},
{
"step_id": 5,
"name": "Generate Comprehensive End-to-End Report for SOS001L12P",
"description": "Provide a narrative report summarizing all findings. \n1. Confirm the observed downward trend in production for SOS001L12P during the second half of the duration, citing specific dates or periods. \n2. Validate the user's observation of many anomalies, providing a count or highlighting key anomaly dates. \n3. Discuss the correlation between actual production, actual sales, and predicted demand, explaining how they interact, especially during the problematic second half. \n4. Comment on the forecasting model's performance based on the calculated WAPE values, noting any significant differences in accuracy between the overall duration and the 'second half'. \n5. Offer insights into potential reasons for observed trends or anomalies and their impact on supply chain planning.",
"type": "TEXT"
}
]
সম্মিলিত বিশ্লেষণ একটি পরিকল্পনাকারী-প্রস্তুত মূল্যায়ন তৈরি করে, যা তার উপসংহারে নোট করে:
“SKU SOS001L12P-এর জন্য, বিশ্লেষিত সময়ের দ্বিতীয়ার্ধে (এপ্রিল 21, 2023 – 9 আগস্ট, 2023) বর্ধিত অস্থিরতা এবং প্রকৃত উৎপাদনে হ্রাস, সেইসাথে বেশ কিছু অসঙ্গতি দ্বারা চিহ্নিত করা হয়েছিল। প্রকৃত উৎপাদনও এই সময়ের মধ্যে প্রকৃত বিক্রয়ের চেয়ে কম ছিল। যদিও কার্যকরীভাবে trWA মডেলের চাহিদার ক্যাপচার পূর্বাভাস ছিল। দ্বিতীয়ার্ধে 29.70%), সামগ্রিকভাবে 35.44% উন্নতির ইঙ্গিত দেয়), উৎপাদন এই চাহিদাগুলির সাথে তাল মিলিয়ে চলার জন্য সংগ্রাম করেছে, যার ফলে উৎপাদন এবং বিক্রয় এবং প্রত্যাশিত চাহিদা উভয়ের মধ্যে একটি দুর্বল সম্পর্ক রয়েছে। এই বৈচিত্রগুলি, যা প্রায়শই চিহ্নিত উত্পাদনের অসঙ্গতির সাথে মিলে যায়, সম্ভাব্য সরবরাহের সীমাবদ্ধতা বা অপারেশনাল ব্যাঘাতের পরামর্শ দেয় যা ক্রমাগত চাহিদা মেটাতে আমাদের ক্ষমতাকে প্রভাবিত করছে।“
সম্পূর্ণ রিপোর্ট এখানে
Here is an end-to-end report for SKU SOS001L12P, considering your observations and the recent analyses.
---
### **End-to-End Report: SKU SOS001L12P Analysis (2023-01-01 to 2023-08-09)**
**1. Overview**
This report synthesizes recent production analysis, anomaly detection, and demand forecasting data for SKU SOS001L12P, covering the period from January 1, 2023, to August 9, 2023. The analysis specifically focuses on trends and model performance during the second half of this duration, starting approximately April 21, 2023.
**2. Production Trends and Anomalies**
The analysis confirms your observation regarding production trends in the second half of the duration (from 2023-04-21).
* **Downward Trend and Volatility**: While the time series generally shows a positive visual correlation between Actual Production, Actual Sales, and Predicted Demand, Actual Production appears to be more volatile and exhibits sharper drops compared to Actual Sales and Predicted Demand in certain segments of the second half.
* **Production vs. Sales**: In the second half, Actual Production (average 4866 units) was notably lower than Actual Sales (average 5136 units).
* **Anomalies**: A total of 17 combined anomaly points (based on 'Is_Anomaly=True' or |Z_Score| > 2.5) were identified across the entire dataset. Several of these production anomalies were detected in the second half, specifically on dates such as 2023-04-21, 2023-05-05, 2023-05-21, 2023-05-22, and 2023-05-23. These anomaly periods often coincide with significant divergences where Actual Production deviates sharply from Actual Sales and Predicted Demand.
**3. Correlation: Production, Demand Forecast, and Sales**
The correlation analysis in the second half of the duration (from 2023-04-21) reveals distinct relationships:
* **Strong Sales-Demand Correlation**: Actual Sales and Predicted Demand show a strong positive correlation of **0.85**. This suggests the forecasting model is generally effective in tracking actual sales patterns.
* **Weak Production Correlation**: Actual Production's correlation with both Actual Sales and Predicted Demand is significantly weaker:
* Actual Production vs. Actual Sales: **0.35**
* Actual Production vs. Predicted Demand: **0.38**
* **Divergence**: Despite a general visual correlation across the entire period, the second half exhibits noticeable periods where Actual Production diverges from Actual Sales and Predicted Demand. This is particularly evident during the observed anomalies, indicating that production output did not consistently align with market demand or sales in these instances.
**4. Demand Forecasting Model Performance**
The forecasting model's performance was assessed using the Weighted Average Percentage Error (WAPE):
* **Overall Performance**: The overall WAPE for SOS001L12P across the entire duration is **35.44%**.
* **Second Half Performance**: For the 'second half' of the duration (from 2023-04-21), the WAPE is **29.70%**.
* **Interpretation**: The WAPE in the second half is lower than the overall WAPE. This indicates that, despite the observed production issues and anomalies during this period, the demand forecasting model's accuracy actually **improved** in the second half. The model's Predicted Demand consistently tracks Actual Sales closely, suggesting it is reasonably effective in capturing demand patterns for planning purposes.
**Conclusion**
For SKU SOS001L12P, the second half of the analyzed duration (April 21, 2023 - August 9, 2023) was characterized by increased volatility and a downward trend in Actual Production, accompanied by numerous anomalies. Actual Production during this period was also lower than Actual Sales. While the demand forecasting model effectively captured Actual Sales trends (WAPE of 29.70% in the second half, showing an improvement from the overall 35.44%), production struggled to align with these demands, leading to weak correlations between production and both sales and predicted demand. These divergences, often coinciding with identified production anomalies, suggest potential supply constraints or operational disruptions impacting our ability to meet demand consistently.
এটি একটি প্রোডাকশন-গ্রেড রিপোর্ট যাতে প্রাপ্ত ব্যাখ্যাগুলিকে সমর্থন করার জন্য তথ্য, পরিসংখ্যান এবং কেপিআই অন্তর্ভুক্ত থাকে।
এবং এই সমস্ত একটি সম্পূর্ণ নমনীয় এজেন্টিক কাঠামোর সাথে অর্জন করা হয়েছিল যা যে কোনও পছন্দসই ব্যাখ্যামূলক লক্ষ্যের সাথে খাপ খাইয়ে নিতে পারে।
এই অ্যাপ্লিকেশনটি বিকাশ এবং পরীক্ষা করার পাশাপাশি উপরের রিপোর্ট এবং ফলাফলগুলি তৈরি করতে টোকেন ব্যবহারের খরচ $1-এর কম।
উপসংহার
এজেন্টিক সিস্টেমের ভবিষ্যত বড় টুল ক্যাটালগ বা আরও বিস্তৃত অর্কেস্ট্রেশন ফ্রেমওয়ার্ক নয়। এটা এজেন্ট যারা প্রথম স্থানে কি থাকা উচিত তা নির্ধারণ করতে পারে.
যখন পরিকল্পনা, কোডিং এবং সম্পাদনকে যৌক্তিক পদক্ষেপ হিসাবে বিবেচনা করা হয়, তখন সরঞ্জামগুলি স্থির সম্পদ থেকে বিরত থাকে এবং নিষ্পত্তিযোগ্য শিল্পকর্মে পরিণত হয়-বিল্ট, ব্যবহার করা এবং সমস্যার দাবি হিসাবে বাতিল করা হয়। এটি এজেন্ট ডিজাইনকে দ্রুত ইঞ্জিনিয়ারিং থেকে দূরে সরিয়ে দেয় একটি মূল ক্ষমতা হিসাবে সফ্টওয়্যার তৈরির দিকে এজেন্ট এবং সরঞ্জামগুলিকে একটি অর্কেস্ট্রেশন কাঠামোর সাথে বাঁধার চেষ্টা করে।
প্ল্যান-কোড-এক্সিকিউট আর্কিটেকচারগুলি দেখায় যে প্রোডাকশন-গ্রেড, প্রমাণ-ভিত্তিক বিশ্লেষণ ন্যূনতম আঠালো কোড এবং ন্যূনতম খরচ সহ ছোট, স্বচ্ছ এজেন্ট থেকে আবির্ভূত হতে পারে। LLM-এর উন্নতি অব্যাহত থাকায়, সবচেয়ে মূল্যবান এজেন্ট হবেন যারা স্বায়ত্তশাসিতভাবে কাজ করার সফ্টওয়্যারে অভিপ্রায়কে রূপান্তরিত করতে পারে – কীভাবে তা করতে হবে তা আগে থেকে বলা ছাড়াই।
সেই অর্থে, অটো-প্ল্যানিং এবং অটো-কোডিং এজেন্টগুলি কেবল একটি সুবিধা নয়। তারা এজেন্টিক সিস্টেমের প্রাকৃতিক বিবর্তন।
এই নিবন্ধে উল্লেখ করা চাহিদা পূর্বাভাসের জন্য GNN মডেল সম্পর্কে আরও তথ্যের জন্য, আমার নিবন্ধটি পড়ুন এখানে.
আমার সাথে সংযোগ করুন এবং www.linkedin.com/in/partha-sarkar-let’s-talk-AI-তে আপনার মন্তব্য শেয়ার করুন
রেফারেন্স
সাপ্লাইগ্রাফ: গ্রাফ নিউরাল নেটওয়ার্ক ব্যবহার করে সাপ্লাই চেইন প্ল্যানিংয়ের জন্য একটি বেঞ্চমার্ক ডেটাসেট লেখক: আজমিন তৌশিক ওয়াসি, এমডি শফিকুল ইসলাম, আদিপ্ত রায়হান আকিব
এই নিবন্ধে ব্যবহৃত ছবিগুলি গুগল মিথুন ব্যবহার করে তৈরি করা হয়েছে। আমার দ্বারা তৈরি চার্ট এবং অন্তর্নিহিত কোড.