This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/main by this push:
     new 0c46c78363 Fixes #8857. Tighten langchain4j agent MCP test coverage 
(#8997)
0c46c78363 is described below

commit 0c46c783635f9088e7d256ee908c2ac1830fafef
Author: GaĆ«lle Fournier <[email protected]>
AuthorDate: Thu Aug 13 14:55:10 2026 +0200

    Fixes #8857. Tighten langchain4j agent MCP test coverage (#8997)
    
    Add integration tests for structured output (outputClass and jsonSchema), 
AgentConfiguration auto-provisioning (with and without memory), and MCP server 
configuration via inline URI options. Fix typo isNodeJSInstaled.
    
    Co-authored-by: Bob <[email protected]>
---
 .../src/main/resources/application.properties      |  2 +-
 ..._chat-3a4b5c6d-7e8f-9012-abcd-ef3456789012.json | 24 ++++++
 ..._chat-a1b2c3d4-e5f6-7890-abcd-ef1234567890.json | 24 ++++++
 .../langchain4j/agent/it/AgentProducers.java       | 35 ++++++++-
 .../agent/it/Langchain4jAgentResource.java         | 75 ++++++++++++++++++
 .../agent/it/Langchain4jAgentRoutes.java           | 30 +++++++-
 .../langchain4j/agent/it/model/TestPojo.java       |  3 +
 .../src/main/resources/application.properties      |  2 +-
 .../main/resources/schemas/test-pojo-schema.json   | 18 +++++
 .../langchain4j/agent/it/Langchain4jAgentTest.java | 89 ++++++++++++++++++++++
 ..._chat-87f109c4-a6de-4770-bab4-8bbbdc5f6d4a.json |  6 +-
 ..._chat-a1b2c3d4-e5f6-7890-abcd-ef1234567890.json | 24 ++++++
 ...chat-b2c3d4e5-f6a7-8901-bcde-f12345678901.json} | 10 +--
 ..._chat-c85f8b72-57ab-4cce-9992-6114020e011a.json |  2 +-
 14 files changed, 329 insertions(+), 15 deletions(-)

diff --git 
a/integration-tests/langchain4j-agent-ql4j/src/main/resources/application.properties
 
b/integration-tests/langchain4j-agent-ql4j/src/main/resources/application.properties
index 057f03e68a..58f1089f9b 100644
--- 
a/integration-tests/langchain4j-agent-ql4j/src/main/resources/application.properties
+++ 
b/integration-tests/langchain4j-agent-ql4j/src/main/resources/application.properties
@@ -14,7 +14,7 @@
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
-quarkus.native.resources.includes=rag/*
+quarkus.native.resources.includes=rag/*,schemas/*
 quarkus.http.test-timeout=120S
 
 quarkus.devservices.enabled=false
diff --git 
a/integration-tests/langchain4j-agent-ql4j/src/test/resources/mappings/agent/api_chat-3a4b5c6d-7e8f-9012-abcd-ef3456789012.json
 
b/integration-tests/langchain4j-agent-ql4j/src/test/resources/mappings/agent/api_chat-3a4b5c6d-7e8f-9012-abcd-ef3456789012.json
new file mode 100644
index 0000000000..92ebea764f
--- /dev/null
+++ 
b/integration-tests/langchain4j-agent-ql4j/src/test/resources/mappings/agent/api_chat-3a4b5c6d-7e8f-9012-abcd-ef3456789012.json
@@ -0,0 +1,24 @@
+{
+  "id" : "3a4b5c6d-7e8f-9012-abcd-ef3456789012",
+  "name" : "api_chat",
+  "request" : {
+    "url" : "/api/chat",
+    "method" : "POST",
+    "bodyPatterns" : [ {
+      "equalToJson" : "{\n  \"model\" : \"orca-mini\",\n  \"messages\" : [ {\n 
   \"role\" : \"user\",\n    \"content\" : \"Return an example JSON object 
about a person named 'John Doe' with the fields name and description\"\n  } 
],\n  \"options\" : {\n    \"temperature\" : 0.3,\n    \"stop\" : [ ]\n  },\n  
\"format\" : {\n    \"type\" : \"object\",\n    \"properties\" : {\n      
\"name\" : {\n        \"type\" : \"string\",\n        \"description\" : \"The 
name of the person\"\n      },\ [...]
+      "ignoreArrayOrder" : true,
+      "ignoreExtraElements" : false
+    } ]
+  },
+  "response" : {
+    "status" : 200,
+    "body" : 
"{\"model\":\"orca-mini\",\"created_at\":\"2026-04-23T07:06:42.123456789Z\",\"message\":{\"role\":\"assistant\",\"content\":\"{\\\"name\\\":
 \\\"John Doe\\\", \\\"description\\\": \\\"John Doe is a person who is highly 
intelligent and has a great sense of humor. He is also very hardworking and 
dedicated to his 
work.\\\"}\"},\"done\":true,\"done_reason\":\"stop\",\"total_duration\":4074540384,\"load_duration\":17855473,\"prompt_eval_count\":60,\"prompt_eval_duration\":5507086
 [...]
+    "headers" : {
+      "Date" : "Thu, 23 Apr 2026 07:06:42 GMT",
+      "Content-Type" : "application/json; charset=utf-8"
+    }
+  },
+  "uuid" : "3a4b5c6d-7e8f-9012-abcd-ef3456789012",
+  "persistent" : true,
+  "insertionIndex" : 25
+}
diff --git 
a/integration-tests/langchain4j-agent-ql4j/src/test/resources/mappings/agent/api_chat-a1b2c3d4-e5f6-7890-abcd-ef1234567890.json
 
b/integration-tests/langchain4j-agent-ql4j/src/test/resources/mappings/agent/api_chat-a1b2c3d4-e5f6-7890-abcd-ef1234567890.json
new file mode 100644
index 0000000000..0f9297466d
--- /dev/null
+++ 
b/integration-tests/langchain4j-agent-ql4j/src/test/resources/mappings/agent/api_chat-a1b2c3d4-e5f6-7890-abcd-ef1234567890.json
@@ -0,0 +1,24 @@
+{
+  "id" : "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
+  "name" : "api_chat",
+  "request" : {
+    "url" : "/api/chat",
+    "method" : "POST",
+    "bodyPatterns" : [ {
+      "equalToJson" : "{\n  \"model\" : \"orca-mini\",\n  \"messages\" : [ {\n 
   \"role\" : \"user\",\n    \"content\" : \"Return an example JSON object 
about a person named 'John Doe' with the fields name and description\"\n  } 
],\n  \"options\" : {\n    \"temperature\" : 0.3,\n    \"stop\" : [ ]\n  },\n  
\"format\" : {\n    \"type\" : \"object\",\n    \"properties\" : {\n      
\"name\" : {\n        \"type\" : \"string\"\n      },\n      \"description\" : 
{\n        \"type\" : \"string [...]
+      "ignoreArrayOrder" : true,
+      "ignoreExtraElements" : false
+    } ]
+  },
+  "response" : {
+    "status" : 200,
+    "body" : 
"{\"model\":\"orca-mini\",\"created_at\":\"2026-04-23T07:06:41.989124171Z\",\"message\":{\"role\":\"assistant\",\"content\":\"{\\\"name\\\":
 \\\"John Doe\\\", \\\"description\\\": \\\"John Doe is a person who is highly 
intelligent and has a great sense of humor. He is also very organized and 
always has his priorities in 
order.\\\"}\"},\"done\":true,\"done_reason\":\"stop\",\"total_duration\":4311746886,\"load_duration\":16876461,\"prompt_eval_count\":60,\"prompt_eval_duratio
 [...]
+    "headers" : {
+      "Date" : "Thu, 23 Apr 2026 07:06:41 GMT",
+      "Content-Type" : "application/json; charset=utf-8"
+    }
+  },
+  "uuid" : "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
+  "persistent" : true,
+  "insertionIndex" : 25
+}
diff --git 
a/integration-tests/langchain4j-agent/src/main/java/org/apache/camel/quarkus/component/langchain4j/agent/it/AgentProducers.java
 
b/integration-tests/langchain4j-agent/src/main/java/org/apache/camel/quarkus/component/langchain4j/agent/it/AgentProducers.java
index b0b54d04e2..80d61819ac 100644
--- 
a/integration-tests/langchain4j-agent/src/main/java/org/apache/camel/quarkus/component/langchain4j/agent/it/AgentProducers.java
+++ 
b/integration-tests/langchain4j-agent/src/main/java/org/apache/camel/quarkus/component/langchain4j/agent/it/AgentProducers.java
@@ -67,7 +67,7 @@ public class AgentProducers {
     String baseUrl;
 
     @ConfigProperty(name = "nodejs.installed")
-    boolean isNodeJSInstaled;
+    boolean isNodeJSInstalled;
 
     @Produces
     @Identifier("ollamaOrcaMiniModel")
@@ -234,10 +234,41 @@ public class AgentProducers {
                 .withCustomTools(List.of(new AdditionTool())));
     }
 
+    @Produces
+    @Identifier("agentConfigSimple")
+    AgentConfiguration agentConfigSimple(@Identifier("ollamaOrcaMiniModel") 
ChatModel chatModel) {
+        return new AgentConfiguration().withChatModel(chatModel);
+    }
+
+    @Produces
+    @Identifier("agentConfigWithMemory")
+    AgentConfiguration agentConfigWithMemory(@Identifier("granite4Model") 
ChatModel chatModel,
+            ChatMemoryStore chatMemoryStore) {
+        ChatMemoryProvider chatMemoryProvider = memoryId -> 
MessageWindowChatMemory.builder()
+                .id(memoryId)
+                .maxMessages(10)
+                .chatMemoryStore(chatMemoryStore)
+                .build();
+        return new AgentConfiguration()
+                .withChatModel(chatModel)
+                .withChatMemoryProvider(chatMemoryProvider);
+    }
+
+    @Produces
+    @Identifier("agentConfigForMcp")
+    AgentConfiguration agentConfigForMcp(@Identifier("granite4Model") 
ChatModel chatModel) {
+        return new AgentConfiguration()
+                .withChatModel(chatModel)
+                .withMcpToolProviderFilter((mcpClient, toolSpecification) -> {
+                    String toolName = toolSpecification.name().toLowerCase();
+                    return toolName.contains("add") || 
toolName.contains("echo") || toolName.contains("long");
+                });
+    }
+
     @Produces
     @Identifier("agentWithMcpClient")
     Agent agentWithMcpClient(@Identifier("granite4Model") ChatModel chatModel) 
{
-        if (isNodeJSInstaled) {
+        if (isNodeJSInstalled) {
             return new AgentWithoutMemory(new AgentConfiguration()
                     .withChatModel(chatModel)
                     .withMcpClient(new DefaultMcpClient.Builder()
diff --git 
a/integration-tests/langchain4j-agent/src/main/java/org/apache/camel/quarkus/component/langchain4j/agent/it/Langchain4jAgentResource.java
 
b/integration-tests/langchain4j-agent/src/main/java/org/apache/camel/quarkus/component/langchain4j/agent/it/Langchain4jAgentResource.java
index 0f2d939b8a..b831b6db0f 100644
--- 
a/integration-tests/langchain4j-agent/src/main/java/org/apache/camel/quarkus/component/langchain4j/agent/it/Langchain4jAgentResource.java
+++ 
b/integration-tests/langchain4j-agent/src/main/java/org/apache/camel/quarkus/component/langchain4j/agent/it/Langchain4jAgentResource.java
@@ -252,4 +252,79 @@ public class Langchain4jAgentResource {
                 .header(HttpHeaders.CONTENT_TYPE, contentType)
                 .build();
     }
+
+    @Path("/structured-output/class")
+    @POST
+    @Consumes(MediaType.TEXT_PLAIN)
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response structuredOutputClass(String userMessage) {
+        String result = producerTemplate.to("direct:structured-output-class")
+                .withBody(userMessage)
+                .request(String.class);
+
+        return Response.ok(result.trim())
+                .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+                .build();
+    }
+
+    @Path("/structured-output/json-schema")
+    @POST
+    @Consumes(MediaType.TEXT_PLAIN)
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response structuredOutputJsonSchema(String userMessage) {
+        String result = 
producerTemplate.to("direct:structured-output-json-schema")
+                .withBody(userMessage)
+                .request(String.class);
+
+        return Response.ok(result.trim())
+                .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+                .build();
+    }
+
+    @Path("/auto-provision/simple")
+    @POST
+    @Consumes(MediaType.TEXT_PLAIN)
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response autoProvisionSimple(String userMessage) {
+        String result = producerTemplate.to("direct:auto-provision-simple")
+                .withBody(userMessage)
+                .request(String.class);
+
+        return Response.ok(result.trim()).build();
+    }
+
+    @Path("/auto-provision/memory")
+    @POST
+    @Consumes(MediaType.TEXT_PLAIN)
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response autoProvisionMemory(
+            @QueryParam("memoryId") String memoryId,
+            String userMessage) {
+
+        Map<String, Object> headers = new HashMap<>();
+        headers.put(MEMORY_ID, memoryId);
+
+        String result = producerTemplate.to("direct:auto-provision-memory")
+                .withBody(userMessage)
+                .withHeaders(headers)
+                .request(String.class);
+
+        return Response.ok(result.trim()).build();
+    }
+
+    @Path("/mcp/server-config")
+    @POST
+    @Consumes(MediaType.TEXT_PLAIN)
+    @Produces(value = { MediaType.TEXT_PLAIN, MediaType.APPLICATION_JSON })
+    public Response mcpServerConfig(String userMessage) {
+        String result = producerTemplate.to("direct:mcp-server-config")
+                .withBody(userMessage)
+                .request(String.class);
+
+        String contentType = userMessage.contains("JSON") ? 
MediaType.APPLICATION_JSON : MediaType.TEXT_PLAIN;
+
+        return Response.ok(result.trim())
+                .header(HttpHeaders.CONTENT_TYPE, contentType)
+                .build();
+    }
 }
diff --git 
a/integration-tests/langchain4j-agent/src/main/java/org/apache/camel/quarkus/component/langchain4j/agent/it/Langchain4jAgentRoutes.java
 
b/integration-tests/langchain4j-agent/src/main/java/org/apache/camel/quarkus/component/langchain4j/agent/it/Langchain4jAgentRoutes.java
index 1a53f7d32c..8da6e01921 100644
--- 
a/integration-tests/langchain4j-agent/src/main/java/org/apache/camel/quarkus/component/langchain4j/agent/it/Langchain4jAgentRoutes.java
+++ 
b/integration-tests/langchain4j-agent/src/main/java/org/apache/camel/quarkus/component/langchain4j/agent/it/Langchain4jAgentRoutes.java
@@ -18,6 +18,7 @@ package 
org.apache.camel.quarkus.component.langchain4j.agent.it;
 
 import jakarta.enterprise.context.ApplicationScoped;
 import org.apache.camel.builder.RouteBuilder;
+import 
org.apache.camel.quarkus.component.langchain4j.agent.it.util.ProcessUtils;
 import org.eclipse.microprofile.config.inject.ConfigProperty;
 
 @ApplicationScoped
@@ -25,7 +26,7 @@ public class Langchain4jAgentRoutes extends RouteBuilder {
     public static final String USER_JOHN = "John Doe";
 
     @ConfigProperty(name = "nodejs.installed")
-    boolean isNodeJSInstaled;
+    boolean isNodeJSInstalled;
 
     @Override
     public void configure() throws Exception {
@@ -66,9 +67,34 @@ public class Langchain4jAgentRoutes extends RouteBuilder {
         from("direct:agent-with-custom-tools")
                 
.to("langchain4j-agent:test-agent-custom-tools?agent=#agentWithCustomTools");
 
-        if (isNodeJSInstaled) {
+        // Structured output - outputClass
+        from("direct:structured-output-class")
+                
.to("langchain4j-agent:test-so-class?agentConfiguration=#agentConfigSimple"
+                        + 
"&outputClass=org.apache.camel.quarkus.component.langchain4j.agent.it.model.TestPojo");
+
+        // Structured output - jsonSchema from classpath resource
+        from("direct:structured-output-json-schema")
+                
.to("langchain4j-agent:test-so-schema?agentConfiguration=#agentConfigSimple"
+                        + 
"&jsonSchema=resource:classpath:schemas/test-pojo-schema.json");
+
+        // AgentConfiguration auto-provisioning without memory
+        from("direct:auto-provision-simple")
+                
.to("langchain4j-agent:test-auto-simple?agentConfiguration=#agentConfigSimple");
+
+        // AgentConfiguration auto-provisioning with memory
+        from("direct:auto-provision-memory")
+                
.to("langchain4j-agent:test-auto-memory?agentConfiguration=#agentConfigWithMemory");
+
+        if (isNodeJSInstalled) {
             from("direct:agent-with-mcp-client")
                     
.to("langchain4j-agent:test-agent-with-mcp-client?agent=#agentWithMcpClient");
+
+            // MCP server config via inline URI options
+            from("direct:mcp-server-config")
+                    
.to("langchain4j-agent:test-mcp-config?agentConfiguration=#agentConfigForMcp"
+                            + "&mcpServer.everything.transportType=stdio"
+                            + "&mcpServer.everything.command=" + 
ProcessUtils.getNpxExecutable()
+                            + 
",-y,@modelcontextprotocol/[email protected]");
         }
     }
 }
diff --git 
a/integration-tests/langchain4j-agent/src/main/java/org/apache/camel/quarkus/component/langchain4j/agent/it/model/TestPojo.java
 
b/integration-tests/langchain4j-agent/src/main/java/org/apache/camel/quarkus/component/langchain4j/agent/it/model/TestPojo.java
index be28be175c..02e6c16071 100644
--- 
a/integration-tests/langchain4j-agent/src/main/java/org/apache/camel/quarkus/component/langchain4j/agent/it/model/TestPojo.java
+++ 
b/integration-tests/langchain4j-agent/src/main/java/org/apache/camel/quarkus/component/langchain4j/agent/it/model/TestPojo.java
@@ -16,5 +16,8 @@
  */
 package org.apache.camel.quarkus.component.langchain4j.agent.it.model;
 
+import io.quarkus.runtime.annotations.RegisterForReflection;
+
+@RegisterForReflection
 public record TestPojo(String name, String description) {
 }
diff --git 
a/integration-tests/langchain4j-agent/src/main/resources/application.properties 
b/integration-tests/langchain4j-agent/src/main/resources/application.properties
index e336e0a1bc..ec950db064 100644
--- 
a/integration-tests/langchain4j-agent/src/main/resources/application.properties
+++ 
b/integration-tests/langchain4j-agent/src/main/resources/application.properties
@@ -14,7 +14,7 @@
 ## See the License for the specific language governing permissions and
 ## limitations under the License.
 ## ---------------------------------------------------------------------------
-quarkus.native.resources.includes=rag/*
+quarkus.native.resources.includes=rag/*,schemas/*
 quarkus.http.test-timeout=120S
 
 # This can be handy for detecting output from DefaultMcpClient npx process in 
case of eg. slow Windows machine.
diff --git 
a/integration-tests/langchain4j-agent/src/main/resources/schemas/test-pojo-schema.json
 
b/integration-tests/langchain4j-agent/src/main/resources/schemas/test-pojo-schema.json
new file mode 100644
index 0000000000..4c10e239ed
--- /dev/null
+++ 
b/integration-tests/langchain4j-agent/src/main/resources/schemas/test-pojo-schema.json
@@ -0,0 +1,18 @@
+{
+  "type": "object",
+  "properties": {
+    "name": {
+      "type": "string",
+      "description": "The name of the person"
+    },
+    "description": {
+      "type": "string",
+      "description": "A description of the person"
+    }
+  },
+  "required": [
+    "name",
+    "description"
+  ],
+  "additionalProperties": false
+}
diff --git 
a/integration-tests/langchain4j-agent/src/test/java/org/apache/camel/quarkus/component/langchain4j/agent/it/Langchain4jAgentTest.java
 
b/integration-tests/langchain4j-agent/src/test/java/org/apache/camel/quarkus/component/langchain4j/agent/it/Langchain4jAgentTest.java
index 592c361897..69e362521d 100644
--- 
a/integration-tests/langchain4j-agent/src/test/java/org/apache/camel/quarkus/component/langchain4j/agent/it/Langchain4jAgentTest.java
+++ 
b/integration-tests/langchain4j-agent/src/test/java/org/apache/camel/quarkus/component/langchain4j/agent/it/Langchain4jAgentTest.java
@@ -227,6 +227,73 @@ class Langchain4jAgentTest {
                         "toolWasInvoked", is(true));
     }
 
+    @Test
+    void structuredOutputWithOutputClass() {
+        RestAssured.given()
+                .body("Return an example JSON object about a person named '%s' 
with the fields name and description"
+                        .formatted(USER_JOHN))
+                .post("/langchain4j-agent/structured-output/class")
+                .then()
+                .statusCode(200)
+                .body(
+                        "name", is(USER_JOHN),
+                        "description", notNullValue());
+    }
+
+    @Test
+    void structuredOutputWithJsonSchema() {
+        RestAssured.given()
+                .body("Return an example JSON object about a person named '%s' 
with the fields name and description"
+                        .formatted(USER_JOHN))
+                .post("/langchain4j-agent/structured-output/json-schema")
+                .then()
+                .statusCode(200)
+                .body(
+                        "name", is(USER_JOHN),
+                        "description", notNullValue());
+    }
+
+    @Test
+    void autoProvisionSimple() {
+        RestAssured.given()
+                .body(TEST_USER_MESSAGE_SIMPLE)
+                .post("/langchain4j-agent/auto-provision/simple")
+                .then()
+                .statusCode(200)
+                .body(
+                        not(TEST_USER_MESSAGE_SIMPLE),
+                        containsString("Apache Camel"));
+    }
+
+    @Test
+    void autoProvisionWithMemory() {
+        String memoryId = "auto-provision-memory-1";
+
+        RestAssured.given()
+                .queryParam("memoryId", memoryId)
+                .body("Hello - my name is " + USER_ALICE)
+                .post("/langchain4j-agent/auto-provision/memory")
+                .then()
+                .statusCode(200);
+
+        RestAssured.given()
+                .queryParam("memoryId", memoryId)
+                .body("And my favorite color is " + USER_FAVORITE_COLOR)
+                .post("/langchain4j-agent/auto-provision/memory")
+                .then()
+                .statusCode(200);
+
+        RestAssured.given()
+                .queryParam("memoryId", memoryId)
+                .body("Now tell me about myself - what's my name and favorite 
color?")
+                .post("/langchain4j-agent/auto-provision/memory")
+                .then()
+                .statusCode(200)
+                .body(
+                        containsString(USER_ALICE),
+                        containsString(USER_FAVORITE_COLOR));
+    }
+
     @Test
     void agentWithMcpClient() {
         boolean isNodeJSInstalled = 
ConfigProvider.getConfig().getValue("nodejs.installed", boolean.class);
@@ -248,4 +315,26 @@ class Langchain4jAgentTest {
                 .and().body(containsStringIgnoringCase("successfully"))
                 .and().body(containsStringIgnoringCase("executed"));
     }
+
+    @Test
+    void mcpServerConfig() {
+        boolean isNodeJSInstalled = 
ConfigProvider.getConfig().getValue("nodejs.installed", boolean.class);
+        Assumptions.assumeTrue(isNodeJSInstalled, "Node.js is not installed");
+
+        RestAssured.given()
+                .body("Please list your available tools. You MUST respond 
using ONLY valid JSON with tool names as an array. DO NOT add explanations. DO 
NOT add comments. DO NOT wrap in markdown.")
+                .post("/langchain4j-agent/mcp/server-config")
+                .then()
+                .statusCode(200)
+                .body(".", containsInAnyOrder("add", "echo", 
"longRunningOperation"));
+
+        RestAssured.given()
+                .body("Use your available tools to perform a long running 
operation for 2 seconds with 2 steps. DO NOT use any markdown formatting in the 
response.")
+                .post("/langchain4j-agent/mcp/server-config")
+                .then()
+                .statusCode(200)
+                .body(containsStringIgnoringCase("operation"))
+                .and().body(containsStringIgnoringCase("successfully"))
+                .and().body(containsStringIgnoringCase("executed"));
+    }
 }
diff --git 
a/integration-tests/langchain4j-agent/src/test/resources/mappings/agent/api_chat-87f109c4-a6de-4770-bab4-8bbbdc5f6d4a.json
 
b/integration-tests/langchain4j-agent/src/test/resources/mappings/agent/api_chat-87f109c4-a6de-4770-bab4-8bbbdc5f6d4a.json
index a5c08aedf4..b2b3e8ee65 100644
--- 
a/integration-tests/langchain4j-agent/src/test/resources/mappings/agent/api_chat-87f109c4-a6de-4770-bab4-8bbbdc5f6d4a.json
+++ 
b/integration-tests/langchain4j-agent/src/test/resources/mappings/agent/api_chat-87f109c4-a6de-4770-bab4-8bbbdc5f6d4a.json
@@ -5,14 +5,14 @@
     "url" : "/api/chat",
     "method" : "POST",
     "bodyPatterns" : [ {
-      "equalToJson" : "{\n  \"model\" : \"orca-mini\",\n  \"messages\" : [ {\n 
   \"role\" : \"user\",\n    \"content\" : \"Return an example JSON object 
about a person named 'John Doe' with the fields name and description\"\n  } 
],\n  \"options\" : {\n    \"temperature\" : 0.3,\n    \"stop\" : [ ]\n  },\n  
\"stream\" : false,\n  \"tools\" : [ ]\n}",
+      "equalToJson" : "{\n  \"model\" : \"orca-mini\",\n  \"messages\" : [ {\n 
   \"role\" : \"user\",\n    \"content\" : \"Return an example JSON object 
about a person named 'John Doe' with the fields name and description\"\n  } 
],\n  \"options\" : {\n    \"temperature\" : 0.3,\n    \"stop\" : [ ]\n  },\n  
\"format\" : {\n    \"type\" : \"object\",\n    \"properties\" : {\n      
\"name\" : {\n        \"type\" : \"string\",\n        \"description\" : \"The 
name of the person\"\n      },\ [...]
       "ignoreArrayOrder" : true,
       "ignoreExtraElements" : false
     } ]
   },
   "response" : {
     "status" : 200,
-    "body" : 
"{\"model\":\"orca-mini\",\"created_at\":\"2026-04-23T07:00:05.568298313Z\",\"message\":{\"role\":\"assistant\",\"content\":\"
 Sure, here's an example JSON object about John Doe with the fields name and 
description:\\n\\n```\\n{\\n \\\"name\\\": \\\"John Doe\\\",\\n 
\\\"description\\\": \\\"John Doe is a person who is highly intelligent and has 
a great sense of humor. He is also very hardworking and dedicated to his 
work.\\\"\\n}\\n```\"},\"done\":true,\"done_reason\":\"stop [...]
+    "body" : 
"{\"model\":\"orca-mini\",\"created_at\":\"2026-04-23T07:00:05.568298313Z\",\"message\":{\"role\":\"assistant\",\"content\":\"{\\\"name\\\":
 \\\"John Doe\\\", \\\"description\\\": \\\"John Doe is a person who is highly 
intelligent and has a great sense of humor. He is also very hardworking and 
dedicated to his 
work.\\\"}\"},\"done\":true,\"done_reason\":\"stop\",\"total_duration\":4074540384,\"load_duration\":17855473,\"prompt_eval_count\":60,\"prompt_eval_duration\":5507086
 [...]
     "headers" : {
       "Date" : "Thu, 23 Apr 2026 07:00:05 GMT",
       "Content-Type" : "application/json; charset=utf-8"
@@ -21,4 +21,4 @@
   "uuid" : "87f109c4-a6de-4770-bab4-8bbbdc5f6d4a",
   "persistent" : true,
   "insertionIndex" : 15
-}
\ No newline at end of file
+}
diff --git 
a/integration-tests/langchain4j-agent/src/test/resources/mappings/agent/api_chat-a1b2c3d4-e5f6-7890-abcd-ef1234567890.json
 
b/integration-tests/langchain4j-agent/src/test/resources/mappings/agent/api_chat-a1b2c3d4-e5f6-7890-abcd-ef1234567890.json
new file mode 100644
index 0000000000..a3afcee21e
--- /dev/null
+++ 
b/integration-tests/langchain4j-agent/src/test/resources/mappings/agent/api_chat-a1b2c3d4-e5f6-7890-abcd-ef1234567890.json
@@ -0,0 +1,24 @@
+{
+  "id" : "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
+  "name" : "api_chat",
+  "request" : {
+    "url" : "/api/chat",
+    "method" : "POST",
+    "bodyPatterns" : [ {
+      "equalToJson" : "{\n  \"model\" : \"orca-mini\",\n  \"messages\" : [ {\n 
   \"role\" : \"user\",\n    \"content\" : \"Return an example JSON object 
about a person named 'John Doe' with the fields name and description\"\n  } 
],\n  \"options\" : {\n    \"temperature\" : 0.3,\n    \"stop\" : [ ]\n  },\n  
\"format\" : {\n    \"type\" : \"object\",\n    \"properties\" : {\n      
\"name\" : {\n        \"type\" : \"string\"\n      },\n      \"description\" : 
{\n        \"type\" : \"string [...]
+      "ignoreArrayOrder" : true,
+      "ignoreExtraElements" : false
+    } ]
+  },
+  "response" : {
+    "status" : 200,
+    "body" : 
"{\"model\":\"orca-mini\",\"created_at\":\"2026-04-23T07:00:06.123456789Z\",\"message\":{\"role\":\"assistant\",\"content\":\"{\\\"name\\\":
 \\\"John Doe\\\", \\\"description\\\": \\\"John Doe is a person who is highly 
intelligent and has a great sense of humor. He is also very hardworking and 
dedicated to his 
work.\\\"}\"},\"done\":true,\"done_reason\":\"stop\",\"total_duration\":4074540384,\"load_duration\":17855473,\"prompt_eval_count\":60,\"prompt_eval_duration\":5507086
 [...]
+    "headers" : {
+      "Date" : "Thu, 23 Apr 2026 07:00:06 GMT",
+      "Content-Type" : "application/json; charset=utf-8"
+    }
+  },
+  "uuid" : "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
+  "persistent" : true,
+  "insertionIndex" : 23
+}
diff --git 
a/integration-tests/langchain4j-agent/src/test/resources/mappings/agent/api_chat-87f109c4-a6de-4770-bab4-8bbbdc5f6d4a.json
 
b/integration-tests/langchain4j-agent/src/test/resources/mappings/agent/api_chat-b2c3d4e5-f6a7-8901-bcde-f12345678901.json
similarity index 56%
copy from 
integration-tests/langchain4j-agent/src/test/resources/mappings/agent/api_chat-87f109c4-a6de-4770-bab4-8bbbdc5f6d4a.json
copy to 
integration-tests/langchain4j-agent/src/test/resources/mappings/agent/api_chat-b2c3d4e5-f6a7-8901-bcde-f12345678901.json
index a5c08aedf4..5700ab2f0e 100644
--- 
a/integration-tests/langchain4j-agent/src/test/resources/mappings/agent/api_chat-87f109c4-a6de-4770-bab4-8bbbdc5f6d4a.json
+++ 
b/integration-tests/langchain4j-agent/src/test/resources/mappings/agent/api_chat-b2c3d4e5-f6a7-8901-bcde-f12345678901.json
@@ -1,5 +1,5 @@
 {
-  "id" : "87f109c4-a6de-4770-bab4-8bbbdc5f6d4a",
+  "id" : "b2c3d4e5-f6a7-8901-bcde-f12345678901",
   "name" : "api_chat",
   "request" : {
     "url" : "/api/chat",
@@ -12,13 +12,13 @@
   },
   "response" : {
     "status" : 200,
-    "body" : 
"{\"model\":\"orca-mini\",\"created_at\":\"2026-04-23T07:00:05.568298313Z\",\"message\":{\"role\":\"assistant\",\"content\":\"
 Sure, here's an example JSON object about John Doe with the fields name and 
description:\\n\\n```\\n{\\n \\\"name\\\": \\\"John Doe\\\",\\n 
\\\"description\\\": \\\"John Doe is a person who is highly intelligent and has 
a great sense of humor. He is also very hardworking and dedicated to his 
work.\\\"\\n}\\n```\"},\"done\":true,\"done_reason\":\"stop [...]
+    "body" : 
"{\"model\":\"orca-mini\",\"created_at\":\"2026-04-23T07:00:05.568298313Z\",\"message\":{\"role\":\"assistant\",\"content\":\"{\\\"name\\\":
 \\\"John Doe\\\", \\\"description\\\": \\\"John Doe is a person who is highly 
intelligent and has a great sense of humor. He is also very hardworking and 
dedicated to his 
work.\\\"}\"},\"done\":true,\"done_reason\":\"stop\",\"total_duration\":4074540384,\"load_duration\":17855473,\"prompt_eval_count\":60,\"prompt_eval_duration\":5507086
 [...]
     "headers" : {
       "Date" : "Thu, 23 Apr 2026 07:00:05 GMT",
       "Content-Type" : "application/json; charset=utf-8"
     }
   },
-  "uuid" : "87f109c4-a6de-4770-bab4-8bbbdc5f6d4a",
+  "uuid" : "b2c3d4e5-f6a7-8901-bcde-f12345678901",
   "persistent" : true,
-  "insertionIndex" : 15
-}
\ No newline at end of file
+  "insertionIndex" : 24
+}
diff --git 
a/integration-tests/langchain4j-agent/src/test/resources/mappings/agent/api_chat-c85f8b72-57ab-4cce-9992-6114020e011a.json
 
b/integration-tests/langchain4j-agent/src/test/resources/mappings/agent/api_chat-c85f8b72-57ab-4cce-9992-6114020e011a.json
index fe7428d7db..127ae5730d 100644
--- 
a/integration-tests/langchain4j-agent/src/test/resources/mappings/agent/api_chat-c85f8b72-57ab-4cce-9992-6114020e011a.json
+++ 
b/integration-tests/langchain4j-agent/src/test/resources/mappings/agent/api_chat-c85f8b72-57ab-4cce-9992-6114020e011a.json
@@ -21,4 +21,4 @@
   "uuid" : "c85f8b72-57ab-4cce-9992-6114020e011a",
   "persistent" : true,
   "insertionIndex" : 11
-}
\ No newline at end of file
+}

Reply via email to