Skip to main content

Chapter 6 : AI Agents

Build AI Agents​

  • Build AI Agents with No-code and Customize & Extend to complete your use case.
  • Use AI Agents in workflows or as chat.

Prerequisite​

AI Agents Building​

Jumpstart development with AI Agents Building code based on common patterns described in Anthropic's research paper Building Effective Agents.

The agentic system's code model agentic flows in terms of:

  • Multi-LLM Workflows
    • Prompt-Chaining: Decomposes a task into sequential subtasks, where each step builds on previous results.
    • Parallelization: Distributes independent subtasks across multiple LLMs for concurrent processing.

Also available:

  • Chat Agent with access to MCP Tools
    • A simple command-line chat application with access to EasyManage MCP Server Tools available, to chat with AI models.

AI Agents - Spring Java​

AI Agent emagent​

  • Agentic System Workflows with all supported agentic patterns, with access to MCP Tools
  • Low-code customize to build AI solutions

AI Agent emchat​

  • Chat Agent with access to MCP Tools

Locating Agent Projects​

info
  • AI Agent - Spring Java is built along with Backend & MCP spring-java.
  • Project Location in downloaded dir is at e.g.
    • EmGenDir_JohnDoe_WS_51069\WS_51069\agent\spring-java\emagent
  • Chat Agent with access to MCP Tools is at e.g.
    • EmGenDir_JohnDoe_WS_51069\WS_51069\agent\spring-java\emchat

Run Builds and Explore​

tip

AI Agents invoke MCP Layer which Connects to API Layer, REST or GraphQL. So please configure and run destination API Layer first. Then build MCP Layer.

AI Agent emagent​

AI Agent Project Build & Run​

info

Please review Prerequisites in emagent\README.md

  • Make sure emmcp project maven artifact is available for Agent project
  • via building emmcp with mvn clean install
  • Go to Project Location in downloaded dir is at e.g.
    • cd EmGenDir_JohnDoe_WS_51069\WS_51069\agent\spring-java\emagent
  • Set env var: OPENAI_API_KEY
  1. Build the project:

    ./mvnw clean install
  2. Run the application:

    ./mvnw spring-boot:run

AI Agent Example Runs​

• Agent Util Examples​

MCP Tool Calling Pre-configured​

AI Agent to MCP Tool calling is pre-configured and available via util functions.

  • Please view example Util functions in e.g. product table util at
    • emagent\src\main\java\com\example\emagent\app\Product\ProductEmAgentUtil.java

Below functions are made available for each table, developers can choose from them and use in workflows as needed.

    private String prompt_get_table_data_all =  "get table data all from product table"; 
public List<Product> get_table_data_all_product()
private String get_table_data_paged_product = "get table data as pages from product table for page 1 size 10";
public List<Product> get_table_data_paged_product()
//private String get_table_data_queried_product = "get table data queried and sorted as per parameter strings as pages from product table queried as \" productId is not null \" sorted by \" productId desc \" with 1 page size 3 ";
private String get_table_data_queried_product = "get table data as pages from product table queried as \" productId is not null \" sorted by \" productId desc \" with 1 page size 3 ";
public List<Product> get_table_data_queried_product()
private String get_table_data_by_key_product = "get table data by key column from product table for key 1 ";
public List<Product> get_table_data_by_key_product()

private String create_table_data_record_product = "create table data record in product table with values as below ";
public Long create_table_data_record_product()

private String update_table_data_record_product = "update table data record in product table with values as below ";
public Long update_table_data_record_product()

private String delete_table_data_record_product = "delete table data record in product table with value 1 ";
public long delete_table_data_record_product()

//default - get data as String
public String agenticUtil()

• Prompt Chaining Workflow Run​

• Prompt Parallel Workflow Run​

AI Agent emchat​

AI Agent Project Build & Run​

  • Go to Project Location in downloaded dir is at e.g.
    • cd EmGenDir_JohnDoe_WS_51069\WS_51069\agent\spring-java\emchat
  • Set env var: OPENAI_API_KEY
  1. Build the project:

    ./mvnw clean install
  2. Run the application:

    ./mvnw spring-boot:run

Run Chat Example Run​