Skip to main content

Section 7-1 : Agentic Pattern Prompt Chaining

How Is Agentic Pattern Prompt Chaining Used

How Is EasyManage AI Agentic Pattern Prompt Chaining Used.

  • Please see the log outputs below.

Prompt Chaining Workflow Example Run

List MCP Tools

2025-10-20T21:20:48.610+05:30  WARN 14068 --- [emagent_data] [           main] o.s.m.p.s.SyncMcpSamplingProvider        : No sampling methods found
2025-10-20T21:20:48.610+05:30 WARN 14068 --- [emagent_data] [ main] o.s.m.p.e.SyncMcpElicitationProvider : No elicitation methods found
2025-10-20T21:20:52.428+05:30 INFO 14068 --- [emagent_data] [ main] c.example.emagent.app.EmAgentSpringApp : Started EmAgentSpringApp in 5.174 seconds (process running for 5.424)
2025-10-20T21:20:52.428+05:30 INFO 14068 --- [emagent_data] [ main] c.example.emagent.app.EmAgentSpringApp : ------- List MCP Tools Available ------------

Listed MCP Tools

  • Name
Tool Name: get_table_data_customer
Tool Name: get_table_data_queried_customer
Tool Name: get_table_data_by_key_inventory
Tool Name: get_table_data_by_key_shipping
...
  • Name, Description, Input Schema
Tool Name: get_table_data_customer
Tool Description: get table data from customer table
Tool Input Schema: {"type":"object","properties":{},"required":[],"additionalProperties":false}
...

Build ChatClient

2025-10-20T23:47:35.892+05:30  INFO 28280 --- [emagent_data] [           main] c.example.emagent.app.EmAgentSpringApp   : ------- Build ChatClient  ------------
2025-10-20T23:47:35.908+05:30 INFO 28280 --- [emagent_data] [ main] c.example.emagent.app.EmAgentSpringApp : ------- Run EmAgents ------------
------------

Prompt Chaining

  • When set chain
2025-10-20T23:51:18.894+05:30  INFO 35932 --- [emagent_data] [           main] c.example.emagent.app.EmAgentSpringApp   : ------- Set runPattern = [chain] ------------
2025-10-20T23:51:18.894+05:30 INFO 35932 --- [emagent_data] [ main] c.example.emagent.app.EmAgentSpringApp : ------- Run ProductEmAgentChain ------------

Prompts List

            // Step 1 
"""
Call MCP easymanage-mcp Tool get table schema for erp_product
""",
// Step 2
"""
Call MCP easymanage-mcp Tool get table data from erp_product
""",
// Step 3
"""
You will be given erp_product table schema and data.
Analyze table schema and data for insights.
Suggest what insights and trends can be derived from tables.
Prioritize as per high-value to low-value insights.

# erp_product Schema
%s

# erp_product Data
%s
"""

Get Table Schema Response

STEP 0:
The table schema for the Product is as follows:
{
"ErpProduct": {
"type": "object",
"properties": {
"productId": {
"type": "integer",
"format": "int64"
},
"productName": {
"type": "string"
},
"productCategory": {
"type": "string"
},
"primarySupplier": {
"type": "string"
},
"productDesc": {
"type": "string"
},
"productPicture": {
"type": "array",
"items": {
"type": "string",
"format": "byte"
}
}
}
}
}
This schema defines the structure of the `ErpProduct` table, including the data types and properties for each field.

Get Table Data Response

STEP 2:
## Table Data

The data you gave has these fields, but actually includes a **primarySupplier** which is not in the schema (this might be metadata or from a related table), and lacks values for Price, StockQuantity, CreatedAt, UpdatedAt.

Sample data:

ProductID | ProductName | Category | PrimarySupplier |
-----------|-------------------|-----------------|-----------------|
101 | Smartphone Model X| Electronics | Supplier A |
102 | Vacuum Cleaner Pro| Home Appliances | Supplier B |
103 | Learning JSON | Books | Supplier C |

Analyze For Insights Response

STEP 3:
## Potential High-Value to Low-Value Insights From Schema and Data
### High-Value Insights
1. **Category-wise Sales and Inventory Analysis**
- Analyze total stock quantity and average price in each category.
- Identify categories with most inventory, highest revenue potential.
- Track stock depletion rates over time for demand planning.
2. **Price Trends and Pricing Strategy**
- Price distribution across categories or within a category to detect premium vs budget products.
- Historical price changes (using CreatedAt & UpdatedAt) to assess how pricing evolves due to market or seasonality.
3. **Product Lifecycle & Freshness**
- Time since product introduction (CreatedAt) vs last update (UpdatedAt) to understand product lifecycle.
- Flag stale or outdated products for clearance or update.
4. **Stock Management & Replenishment**
- Identify low-stock products (StockQuantity near zero).
- Predict potential stock-outs by combining stock data with sales.
- Optimize inventory to reduce holding costs while avoiding lost sales.
5. **Supplier Performance & Product Sourcing**
- Although not in schema, if supplier info is available, evaluate supplier contribution to inventory and pricing.
- Correlate supplier with product updates or stock changes (if timestamps relate to restock).
---
### Medium-Value Insights
6. **Product Popularity and Demand Trends**
- Track demand changes over time via update timestamps (if updates reflect sales).
- Correlate product introduction dates with sales spike periods (e.g., holidays).
7. **Category Growth or Decline**
- Using CreatedAt frequency, identify categories seeing more new products added (growth areas).
- Conversely, categories with less new product introduction might indicate market decline or saturation.
8. **Price Elasticity Indicators**
- If price changes (UpdatedAt) can be linked to stock quantity or sales, estimate price elasticity.
---
### Lower-Value Insights
9. **Product Naming Patterns**
- Analyze naming conventions for branding consistency.
- Detect potential renaming or variant introductions.
10. **Temporal Updates and Maintenance**
- Frequency of product data updates could indicate product attention or seasonality.
---
## Summary
Priority | Insight Area | Description |
-----------------|-----------------------------------|-------------------------------------------------------------------------------------------------|
High | Category-wise Sales & Inventory | Stock and price distributions by category for revenue and inventory management |
High | Price Trends | Pricing strategies and changes over time |
High | Product Lifecycle & Freshness | Identify outdated vs newly introduced products |
High | Stock Management & Replenishment | Low-stock alerts and stock optimization |
Medium | Demand Trends and Popularity | Product demand variation over time |
Medium | Category Growth or Decline | Assess expanding or contracting product categories |
Medium | Price Elasticity Indicators | Understand customer sensitivity to price changes |
Low | Product Naming Patterns | Branding and product identification |
Low | Temporal Updates & Maintenance | Frequency and timing of product record updates |
---
If additional related data such as sales, supplier details, or reorder history is integrated, many more actionable insights could be generated (e.g., supplier reliability, forecasting, promotion effectiveness).
Let me know if you want a detailed analysis on any specific insight or suggestions on enriching the schema and data!