davsclaus commented on code in PR #25512:
URL: https://github.com/apache/camel/pull/25512#discussion_r3842634837


##########
catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/main/camel-main-configuration-metadata.json:
##########
@@ -445,7 +445,7 @@
     { "name": "camel.server.mcpServerName", "required": false, "description": 
"MCP server name advertised to clients. Defaults to the CamelContext name.", 
"sourceType": "org.apache.camel.main.HttpServerConfigurationProperties", 
"type": "string", "javaType": "java.lang.String", "secret": false },
     { "name": "camel.server.mcpSessionIdleTtl", "required": false, 
"description": "Idle TTL in milliseconds for MCP sessions on the Vert.x 
streamable transport. Sessions with no activity for longer than this interval 
are evicted. 0 disables idle eviction.", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "integer", 
"javaType": "long", "defaultValue": 300000, "secret": false },
     { "name": "camel.server.mcpSessionKeepAliveInterval", "required": false, 
"description": "Keep-alive ping interval in milliseconds for MCP sessions on 
the Vert.x streamable transport. Dead sessions are evicted after consecutive 
ping failures. 0 disables keep-alive pings.", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "integer", 
"javaType": "long", "defaultValue": 30000, "secret": false },
-    { "name": "camel.server.mcpTags", "required": false, "description": 
"Comma-separated list of ai-tool tag patterns to expose as MCP tools. Matching 
is case-insensitive and supports exact match, wildcard prefix ( {code foo} ), 
and {code } to match all tags. Only tools registered under a matching tag are 
exposed; the untagged default pool is never exposed. When not set, no tools are 
exposed.", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string", 
"javaType": "java.lang.String", "secret": false },
+    { "name": "camel.server.mcpTags", "required": false, "description": 
"Comma-separated list of ai-tool tags to expose as MCP tools. Only tools 
registered under one of these tags are exposed; the untagged default pool is 
never exposed. When not set, no tools are exposed.", "sourceType": 
"org.apache.camel.main.HttpServerConfigurationProperties", "type": "string", 
"javaType": "java.lang.String", "secret": false },

Review Comment:
   This reverts the `camel.server.mcpTags` description added intentionally on 
`main` by CAMEL-24390 (wildcard tag-pattern matching), back to the older 
plain-tag-list wording. This PR doesn't touch 
`HttpServerConfigurationProperties.java` at all, so this looks like a side 
effect of regenerating the catalog from a branch that was cut before 
CAMEL-24390 merged. Please rebase onto latest `main` and regenerate the catalog 
so this unrelated change doesn't get reverted.



##########
components/camel-ai/camel-langchain4j-agent/src/main/java/org/apache/camel/component/langchain4j/agent/LangChain4jAgentProducer.java:
##########
@@ -120,10 +120,30 @@ protected void doInit() throws Exception {
             }
         }
 
+        if (hasToolCallingEndpointOptions(endpoint.getConfiguration())) {
+            if (endpoint.getConfiguration().getAgentConfiguration() == null) {
+                throw new IllegalArgumentException(
+                        "maxToolCallingRoundTrips, compensateOnToolErrors, and 
executeToolsConcurrently require "
+                                                   + "agentConfiguration to be 
set (inline agent creation mode). "
+                                                   + "They cannot be used with 
a user-provided agent bean or agentFactory.");
+            }
+            if (endpoint.getConfiguration().getAgent() != null) {
+                throw new IllegalArgumentException(
+                        "Tool-calling endpoint options cannot be combined with 
a user-provided agent bean. "
+                                                   + "They only work in inline 
agent creation mode (agentConfiguration without agent or agentFactory).");
+            }
+            if (endpoint.getConfiguration().getAgentFactory() != null) {

Review Comment:
   This new `agentFactory` conflict check mirrors the `agent`-bean check above 
it (which is covered by `toolCallingUriParamsCannotBeCombinedWithAgentBean`), 
but I don't see an equivalent test exercising this branch. Worth adding a 
`toolCallingUriParamsCannotBeCombinedWithAgentFactory`-style test for parity.



##########
components/camel-ai/camel-langchain4j-agent/src/test/java/org/apache/camel/component/langchain4j/agent/LangChain4jAgentToolCallingUriParamsTest.java:
##########
@@ -0,0 +1,246 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.langchain4j.agent;
+
+import java.util.List;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import dev.langchain4j.agent.tool.ToolExecutionRequest;
+import dev.langchain4j.data.message.AiMessage;
+import dev.langchain4j.model.chat.ChatModel;
+import dev.langchain4j.model.chat.request.ChatRequest;
+import dev.langchain4j.model.chat.response.ChatResponse;
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.langchain4j.agent.api.AgentConfiguration;
+import org.apache.camel.component.langchain4j.agent.api.AiAgentBody;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.spi.Registry;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+/**
+ * Tests for CAMEL-23929: tool-calling options exposed as {@code @UriParam} on 
the langchain4j-agent endpoint.
+ */
+class LangChain4jAgentToolCallingUriParamsTest extends CamelTestSupport {

Review Comment:
   Nice coverage of `executeToolsConcurrently` and `maxToolCallingRoundTrips` 
behavior, but `compensateOnToolErrors` is only exercised through the 
validation-only paths (requires-agentConfiguration / cannot-combine-with-agent) 
— there's no test asserting that setting it via the URI actually changes 
runtime behavior (e.g. a failing tool call being compensated). Consider adding 
one, mirroring the pattern used for the other two options.



##########
components/camel-ai/camel-langchain4j-agent-api/src/main/java/org/apache/camel/component/langchain4j/agent/api/AgentConfiguration.java:
##########
@@ -514,6 +514,20 @@ public AgentConfiguration 
withExecuteToolsConcurrently(Executor executeToolsExec
         return this;
     }
 
+    /**
+     * Sets whether concurrent tool execution is enabled.
+     *
+     * @param  executeToolsConcurrently {@code true} to enable, {@code false} 
to disable, or {@code null} to leave unset
+     * @return                          this configuration instance for method 
chaining
+     */
+    public AgentConfiguration withExecuteToolsConcurrentlyEnabled(Boolean 
executeToolsConcurrently) {

Review Comment:
   Minor nit: `duplicate()` further down in this class (added recently) carries 
`@since 4.23`. For consistency, consider adding the same tag here on this new 
public method.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to