Skip to main content

Section 7-4 : Agentic Pattern Evaluator-Optimizer

How Is Agentic Pattern Evaluator-Optimizer Used

How Is EasyManage AI Agentic Pattern Evaluator-Optimizer Used For Assessing data usefulness for model training.

  • Please see the log outputs below.

Sample Run

  • Showing Usage of: EmAgentEvaluatorOptimizerFixed
  • The loop iteration is fixed to criteria being assesed.
  • Note: For EmAgentEvaluatorOptimizer
    • The loop iteration is decided by model response till PASS.

Input Table

            RefinedResponseFixed refinedResponseFixed = new EmAgentEvaluatorOptimizerFixed(chatClient)
.loop("""
<user input>
erp_customer
</user input>
""");

Input Prompt

            Your goal is to Call MCP easymanage-mcp Tool and fetch table schema and data for the input tables. 

Respond with table schema and data as text response and your thoughts.

Evaluator Prompt

Evaluate supplied table schemas and data for fitness for AI model training, assesses it against criteria:
Criterion 1: (Available): Is table data available ?
Criterion 2: (Sensitive Data): Are there columns that come under Sensitive data, PII (Personally Identifiable Information), Confidential Business Information, Data revealing sensitive personal information?
Criterion 3: (Compliance): Does it comply with GDPR, HIPAA, and other regulations?
Criterion 4: (Bias and fairness): Verify data is acceptable as per Legal; Ethical; Unbiased; Non-discriminatory

Sample Run Outputs

2025-11-03T21:32:52.151+05:30  INFO 49628 --- [emagent] [           main] c.example.emagent.app.EmAgentSpringApp   : Starting EmAgentSpringApp using Java 17.0.10 with PID 49628 (C:\Users\SantroW11\Downloads\EmGenDir_MYTEMP01_WS_51181\WS_51181\agent\spring-java\emagent\target\classes started by SantroW11 in C:\Users\SantroW11\Downloads\EmGenDir_MYTEMP01_WS_51181\WS_51181\agent\spring-java\emagent)
2025-11-03T21:32:52.151+05:30 INFO 49628 --- [emagent] [ main] c.example.emagent.app.EmAgentSpringApp : No active profile set, falling back to 1 default profile: "default"
2025-11-03T21:32:52.660+05:30 WARN 49628 --- [emagent] [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.ai.mcp.client.common.autoconfigure.annotations.McpClientAnnotationScannerAutoConfiguration' of type [org.springframework.ai.mcp.client.common.autoconfigure.annotations.McpClientAnnotationScannerAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected/applied to a currently created BeanPostProcessor [clientAnnotatedMethodBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies/advisors. If this bean does not have to be post-processed, declare it with ROLE_INFRASTRUCTURE.
2025-11-03T21:32:52.660+05:30 WARN 49628 --- [emagent] [ main] trationDelegate$BeanPostProcessorChecker : Bean 'clientAnnotatedBeans' of type [org.springframework.ai.mcp.client.common.autoconfigure.annotations.McpClientAnnotationScannerAutoConfiguration$ClientMcpAnnotatedBeans] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected/applied to a currently created BeanPostProcessor [clientAnnotatedMethodBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies/advisors. If this bean does not have to be post-processed, declare it with ROLE_INFRASTRUCTURE.
2025-11-03T21:32:52.675+05:30 WARN 49628 --- [emagent] [ main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.ai.mcp.client.annotation-scanner-org.springframework.ai.mcp.client.common.autoconfigure.annotations.McpClientAnnotationScannerProperties' of type [org.springframework.ai.mcp.client.common.autoconfigure.annotations.McpClientAnnotationScannerProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected/applied to a currently created BeanPostProcessor [clientAnnotatedMethodBeanPostProcessor]? Check the corresponding BeanPostProcessor declaration and its dependencies/advisors. If this bean does not have to be post-processed, declare it with ROLE_INFRASTRUCTURE.
2025-11-03T21:32:53.032+05:30 WARN 49628 --- [emagent] [ main] o.s.m.p.s.SyncMcpSamplingProvider : No sampling methods found
2025-11-03T21:32:53.039+05:30 WARN 49628 --- [emagent] [ main] o.s.m.p.e.SyncMcpElicitationProvider : No elicitation methods found
2025-11-03T21:32:56.656+05:30 INFO 49628 --- [emagent] [ main] c.example.emagent.app.EmAgentSpringApp : Started EmAgentSpringApp in 4.859 seconds (process running for 5.085)
2025-11-03T21:32:56.656+05:30 INFO 49628 --- [emagent] [ main] c.example.emagent.app.EmAgentSpringApp : ------- List MCP Tools Available ------------
2025-11-03T21:32:56.672+05:30 INFO 49628 --- [emagent] [ main] c.example.emagent.app.EmAgentSpringApp : ------- Total MCP Tools Available: 26 ------------
Tool Name: create_table_data_record_erp_inventory
Tool Name: get_all_api_docs
Tool Name: get_table_data_erp_inventory_vw
Tool Name: create_table_data_record_erp_inventory_sum_vw
Tool Name: get_table_data_queried_erp_product
Tool Name: create_table_data_record_erp_inventory_vw
Tool Name: create_table_data_record_erp_sales_inquiry
Tool Name: get_table_data_by_key_erp_customer
Tool Name: get_all_table_schema
Tool Name: get_table_data_erp_sales_inquiry
Tool Name: get_table_data_queried_erp_sales_inquiry
Tool Name: get_table_data_erp_product
Tool Name: get_table_data_erp_inventory_sum_vw
Tool Name: create_table_data_record_erp_customer
Tool Name: get_table_data_queried_erp_inventory_vw
Tool Name: get_table_data_by_key_erp_inventory_sum_vw
Tool Name: get_table_data_erp_inventory
Tool Name: get_table_data_by_key_erp_inventory_vw
Tool Name: get_table_data_erp_customer
Tool Name: get_table_data_queried_erp_inventory
Tool Name: get_table_data_by_key_erp_sales_inquiry
Tool Name: get_table_data_queried_erp_customer
Tool Name: create_table_data_record_erp_product
Tool Name: get_table_data_by_key_erp_product
Tool Name: get_table_data_queried_erp_inventory_sum_vw
Tool Name: get_table_data_by_key_erp_inventory
2025-11-03T21:32:56.672+05:30 INFO 49628 --- [emagent] [ main] c.example.emagent.app.EmAgentSpringApp : ------- Filter|Use MCP Tools ------------
2025-11-03T21:32:56.672+05:30 INFO 49628 --- [emagent] [ main] c.example.emagent.app.EmAgentSpringApp : ------- Selected MCP Tools ------------
2025-11-03T21:32:56.672+05:30 INFO 49628 --- [emagent] [ main] c.example.emagent.app.EmAgentSpringApp : ------- Total Selected MCP Tools: 20 ------------
Tool Name: get_all_api_docs
Tool Name: get_table_data_erp_inventory_vw
Tool Name: get_table_data_queried_erp_product
Tool Name: get_table_data_by_key_erp_customer
Tool Name: get_all_table_schema
Tool Name: get_table_data_erp_sales_inquiry
Tool Name: get_table_data_queried_erp_sales_inquiry
Tool Name: get_table_data_erp_product
Tool Name: get_table_data_erp_inventory_sum_vw
Tool Name: get_table_data_queried_erp_inventory_vw
Tool Name: get_table_data_by_key_erp_inventory_sum_vw
Tool Name: get_table_data_erp_inventory
Tool Name: get_table_data_by_key_erp_inventory_vw
Tool Name: get_table_data_erp_customer
Tool Name: get_table_data_queried_erp_inventory
Tool Name: get_table_data_by_key_erp_sales_inquiry
Tool Name: get_table_data_queried_erp_customer
Tool Name: get_table_data_by_key_erp_product
Tool Name: get_table_data_queried_erp_inventory_sum_vw
Tool Name: get_table_data_by_key_erp_inventory
2025-11-03T21:32:56.672+05:30 INFO 49628 --- [emagent] [ main] c.example.emagent.app.EmAgentSpringApp : ------- Build ChatClient ------------
2025-11-03T21:32:56.672+05:30 INFO 49628 --- [emagent] [ main] c.example.emagent.app.EmAgentSpringApp : ------- Run EmAgents ------------
2025-11-03T21:32:56.672+05:30 INFO 49628 --- [emagent] [ main] c.example.emagent.app.EmAgentSpringApp : ------- Run EmAgentEvaluatorOptimizer ------------

=== GENERATOR OUTPUT ===
THOUGHTS: Done

RESPONSE:

Table Schema for erp_customer

{
"ErpCustomer": {
"type": "object",
"properties": {
"customerId": {
"type": "string"
},
"name": {
"type": "string"
},
"phone": {
"type": "string"
},
"mobilePhone": {
"type": "string"
},
"pict": {
"type": "array",
"items": {
"type": "string",
"format": "byte"
}
},
"email": {
"type": "string"
},
"website": {
"type": "string"
},
"address": {
"type": "string"
},
"dateofinquiry": {
"type": "string",
"format": "date-time"
},
"requestedqty": {
"type": "integer",
"format": "int64"
},
"reqquoteamt": {
"type": "number",
"format": "float"
},
"meetingpreftime": {
"type": "string",
"format": "date-time"
},
"created": {
"type": "string",
"format": "date-time"
},
"updated": {
"type": "string",
"format": "date-time"
}
}
}
}

Sample Data for erp_customer

NOTE: The sample run was made against incomplete test data.

Data is not shown here.

Evaluator Responses

Thoughts Loop 1

The erp_customer table schema provides a comprehensive structure for managing customer information, including personal details, contact information, inquiry data, and timestamps for tracking the creation and updates of records. The sample data reflects a variety of customers with both complete and incomplete records. It seems that the system accommodates historical data alongside current inquiries, as evidenced by the presence of null values in some fields. This flexibility could be beneficial for maintaining data integrity over time while allowing for updates as new information becomes available.

Evaluation Loop 1

=== EVALUATOR OUTPUT === EVALUATION: NEEDS_IMPROVEMENT

FEEDBACK: The data contains Personally Identifiable Information (PII) such as names, phone numbers, and email addresses, which raises concerns regarding compliance with GDPR and other privacy regulations. Additionally, the presence of sensitive data necessitates improved measures for data protection and anonymization to prevent bias and ensure ethical use.

=== GENERATOR OUTPUT === THOUGHTS: Done

RESPONSE:

Thoughts Loop 2

The erp_customer table schema is well-structured for capturing customer-related information, including both personal and inquiry data. The table includes essential fields such as names, contact numbers, email addresses, and timestamps for inquiries and updates.

The sample data presents a mix of complete and incomplete records, indicating that while there is a significant amount of useful information, there are also many entries with null or placeholder values (e.g., "string 2001"). This variability can affect the quality of data when training AI models.

From a data privacy perspective, the presence of Personally Identifiable Information (PII) such as names, phone numbers, and emails raises compliance issues under GDPR and other privacy regulations. Care must be taken to anonymize or secure this data when used for AI training to avoid potential ethical and legal concerns.

Overall, while the schema is suitable for its intended purpose, attention is required to address the issues of data quality, completeness, and compliance to ensure ethical AI model training.

Evaluation Loop 2

=== EVALUATOR OUTPUT === EVALUATION: NEEDS_IMPROVEMENT

FEEDBACK: The data contains Personally Identifiable Information (PII) such as names, phone numbers, and email addresses, which raises compliance issues with GDPR and other privacy regulations. Additionally, the presence of incomplete records may affect the quality of data for AI training.

------------------------------------------------------------------------
[INFO] BUILD SUCCESS
------------------------------------------------------------------------
[INFO] Total time: 06:04 min
[INFO] Finished at: 2025-11-03T21:38:54+05:30
------------------------------------------------------------------------