You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ji...@apache.org on 2026/08/10 05:30:20 UTC
(camel-quarkus) 01/06: Add camel-quarkus-ai-tool extension
This is an automated email from the ASF dual-hosted git repository.
JiriOndrusek pushed a commit to branch camel-4.22.0-upgrade
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 6d19efe514b3b0356fddef84ef14cd39b475ee04
Author: Jiri Ondrusek <on...@gmail.com>
AuthorDate: Mon Jul 27 10:39:35 2026 +0200
Add camel-quarkus-ai-tool extension
Adds the camel-quarkus-ai-tool extension (runtime + deployment) providing
Quarkus support for Camel's ai-tool: component. The component registers
Camel routes as LLM-callable tools in Camel's AiToolRegistry.
Includes BOM entries, catalog, generated docs, and a basic integration
test that verifies tool registration and invocation via AiToolRegistry.
Co-Authored-By: Claude Opus 4.6 <no...@anthropic.com>
---
catalog/pom.xml | 13 ++
docs/modules/ROOT/examples/components/ai-tool.yml | 13 ++
docs/modules/ROOT/nav.adoc | 1 +
.../ROOT/pages/reference/extensions/ai-tool.adoc | 56 --------
extensions/ai-tool/deployment/pom.xml | 63 ++++++++
.../ai/tool/deployment/AiToolProcessor.java | 30 ++++
extensions/ai-tool/pom.xml | 39 +++++
extensions/ai-tool/runtime/pom.xml | 101 +++++++++++++
extensions/ai-tool/runtime/src/main/doc/usage.adoc | 54 -------
.../main/resources/META-INF/quarkus-extension.yaml | 36 +++++
extensions/pom.xml | 1 +
integration-tests/ai-tool/pom.xml | 112 +++++++++++++++
.../component/ai/tool/it/AiToolResource.java | 137 ++++++++++++++++++
.../quarkus/component/ai/tool/it/AiToolRoutes.java | 74 ++++++++++
.../quarkus/component/ai/tool/it/AiToolIT.java | 24 ++++
.../quarkus/component/ai/tool/it/AiToolTest.java | 159 +++++++++++++++++++++
integration-tests/pom.xml | 1 -
poms/bom/pom.xml | 10 ++
poms/bom/src/main/generated/flattened-full-pom.xml | 10 ++
.../src/main/generated/flattened-reduced-pom.xml | 10 ++
.../generated/flattened-reduced-verbose-pom.xml | 10 ++
tooling/scripts/test-categories.yaml | 1 -
22 files changed, 843 insertions(+), 112 deletions(-)
diff --git a/catalog/pom.xml b/catalog/pom.xml
index 7b654d212c..4da6127a69 100644
--- a/catalog/pom.xml
+++ b/catalog/pom.xml
@@ -123,6 +123,19 @@
</exclusion>
</exclusions>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-ai-tool</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-amqp</artifactId>
diff --git a/docs/modules/ROOT/examples/components/ai-tool.yml b/docs/modules/ROOT/examples/components/ai-tool.yml
new file mode 100644
index 0000000000..a9bf4c3f9b
--- /dev/null
+++ b/docs/modules/ROOT/examples/components/ai-tool.yml
@@ -0,0 +1,13 @@
+# Do not edit directly!
+# This file was generated by camel-quarkus-maven-plugin:update-extension-doc-page
+cqArtifactId: camel-quarkus-ai-tool
+cqArtifactIdBase: ai-tool
+cqNativeSupported: true
+cqStatus: Stable
+cqDeprecated: false
+cqJvmSince: 3.39.0
+cqNativeSince: 3.39.0
+cqCamelPartName: ai-tool
+cqCamelPartTitle: AI Tool
+cqCamelPartDescription: Framework-agnostic consumer endpoint that registers a Camel route as an LLM tool in the shared AiToolRegistry.
+cqExtensionPageTitle: AI Tool
diff --git a/docs/modules/ROOT/nav.adoc b/docs/modules/ROOT/nav.adoc
index db466c825d..d0cd2289b1 100644
--- a/docs/modules/ROOT/nav.adoc
+++ b/docs/modules/ROOT/nav.adoc
@@ -31,6 +31,7 @@
** xref:reference/index.adoc[Extensions]
// extensions: START
*** xref:reference/extensions/a2a.adoc[A2A]
+*** xref:reference/extensions/ai-tool.adoc[AI Tool]
*** xref:reference/extensions/amqp.adoc[AMQP]
*** xref:reference/extensions/as2.adoc[AS2]
*** xref:reference/extensions/asn1.adoc[ASN.1 File]
diff --git a/docs/modules/ROOT/pages/reference/extensions/ai-tool.adoc b/docs/modules/ROOT/pages/reference/extensions/ai-tool.adoc
index 1012044469..16920abb9a 100644
--- a/docs/modules/ROOT/pages/reference/extensions/ai-tool.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/ai-tool.adoc
@@ -92,59 +92,3 @@ from("ai-tool:greet?description=Greet a user"
.setBody(simple("Hello, ${header.name}!"));
----
-[id="extensions-ai-tool-usage-langchain4j-integration"]
-=== LangChain4j integration
-
-When both `camel-quarkus-ai-tool` and a Quarkus LangChain4j extension (`quarkus-langchain4j-ollama`, `quarkus-langchain4j-openai`, etc.) are on the classpath, a `ToolProvider` CDI bean is registered automatically at build time.
-All routes registered via `ai-tool:` endpoints become available to `@RegisterAiService` AI services without explicit wiring.
-
-You must also add `camel-langchain4j-agent` to your project dependencies. This artifact provides the `AiToolSpec` to `ToolSpecification` conversion and is not brought in transitively.
-
-[source,xml]
-----
-<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-langchain4j-agent</artifactId>
-</dependency>
-----
-
-With both dependencies in place, a `@RegisterAiService` interface can call Camel tools directly:
-
-[source,java]
-----
-@RegisterAiService
-public interface WeatherAiService {
- String chat(@UserMessage String question);
-}
-----
-
-Any `ai-tool:` route is now callable by the LLM behind `WeatherAiService`. No `toolProvider` attribute or manual bean reference is needed.
-
-[id="extensions-ai-tool-usage-tag-filtering-with-camelaitools"]
-==== Tag filtering with `@CamelAiTools`
-
-By default, all registered `ai-tool:` routes are visible to every AI service. When you need different AI services to see different subsets of tools, annotate the service interface with `@CamelAiTools` and specify a tag value that matches the `tags` parameter on your `ai-tool:` routes.
-
-[source,java]
-----
-@RegisterAiService
-@CamelAiTools("weather")
-public interface WeatherAgent {
- String chat(@UserMessage String question);
-}
-
-@RegisterAiService
-@CamelAiTools("support")
-public interface SupportAgent {
- String chat(@UserMessage String question);
-}
-----
-
-With this setup:
-
-* `WeatherAgent` sees only tools tagged with `weather` (plus any untagged tools from the default pool).
-* `SupportAgent` sees only tools tagged with `support` (plus any untagged tools from the default pool).
-* A `@RegisterAiService` without `@CamelAiTools` sees all registered tools regardless of tags.
-
-NOTE: The `@CamelAiTools` value must match a tag declared in the `ai-tool:` endpoint URI (e.g. `from("ai-tool:getWeather?tags=weather&...")`). If the annotation value is blank or does not match any route tag, the AI service will only see untagged tools.
-
diff --git a/extensions/ai-tool/deployment/pom.xml b/extensions/ai-tool/deployment/pom.xml
new file mode 100644
index 0000000000..23a1f28a7b
--- /dev/null
+++ b/extensions/ai-tool/deployment/pom.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-ai-tool-parent</artifactId>
+ <version>3.39.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-ai-tool-deployment</artifactId>
+ <name>Camel Quarkus :: AI Tool :: Deployment</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-ai-tool</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-processor</artifactId>
+ <version>${quarkus.version}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/extensions/ai-tool/deployment/src/main/java/org/apache/camel/quarkus/component/ai/tool/deployment/AiToolProcessor.java b/extensions/ai-tool/deployment/src/main/java/org/apache/camel/quarkus/component/ai/tool/deployment/AiToolProcessor.java
new file mode 100644
index 0000000000..e132611dd1
--- /dev/null
+++ b/extensions/ai-tool/deployment/src/main/java/org/apache/camel/quarkus/component/ai/tool/deployment/AiToolProcessor.java
@@ -0,0 +1,30 @@
+/*
+ * 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.quarkus.component.ai.tool.deployment;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+
+class AiToolProcessor {
+
+ private static final String FEATURE = "camel-ai-tool";
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+}
diff --git a/extensions/ai-tool/pom.xml b/extensions/ai-tool/pom.xml
new file mode 100644
index 0000000000..5720013059
--- /dev/null
+++ b/extensions/ai-tool/pom.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-extensions</artifactId>
+ <version>3.39.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-ai-tool-parent</artifactId>
+ <name>Camel Quarkus :: AI Tool</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>deployment</module>
+ <module>runtime</module>
+ </modules>
+</project>
diff --git a/extensions/ai-tool/runtime/pom.xml b/extensions/ai-tool/runtime/pom.xml
new file mode 100644
index 0000000000..2a706452fd
--- /dev/null
+++ b/extensions/ai-tool/runtime/pom.xml
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-ai-tool-parent</artifactId>
+ <version>3.39.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-ai-tool</artifactId>
+ <name>Camel Quarkus :: AI Tool :: Runtime</name>
+ <description>Framework-agnostic consumer endpoint that registers a Camel route as an LLM tool in the shared AiToolRegistry.</description>
+
+ <properties>
+ <camel.quarkus.jvmSince>3.39.0</camel.quarkus.jvmSince>
+ <camel.quarkus.nativeSince>3.39.0</camel.quarkus.nativeSince>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-ai-tool</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-processor</artifactId>
+ <version>${quarkus.version}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+ <profiles>
+ <profile>
+ <id>full</id>
+ <activation>
+ <property>
+ <name>!quickly</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>update-extension-doc-page</id>
+ <goals>
+ <goal>update-extension-doc-page</goal>
+ </goals>
+ <phase>process-classes</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
diff --git a/extensions/ai-tool/runtime/src/main/doc/usage.adoc b/extensions/ai-tool/runtime/src/main/doc/usage.adoc
index 36359bf410..677f114f7c 100644
--- a/extensions/ai-tool/runtime/src/main/doc/usage.adoc
+++ b/extensions/ai-tool/runtime/src/main/doc/usage.adoc
@@ -41,57 +41,3 @@ from("ai-tool:greet?description=Greet a user"
+ "¶meter.name=string¶meter.name.required=true")
.setBody(simple("Hello, ${header.name}!"));
----
-
-=== LangChain4j integration
-
-When both `camel-quarkus-ai-tool` and a Quarkus LangChain4j extension (`quarkus-langchain4j-ollama`, `quarkus-langchain4j-openai`, etc.) are on the classpath, a `ToolProvider` CDI bean is registered automatically at build time.
-All routes registered via `ai-tool:` endpoints become available to `@RegisterAiService` AI services without explicit wiring.
-
-You must also add `camel-langchain4j-agent` to your project dependencies. This artifact provides the `AiToolSpec` to `ToolSpecification` conversion and is not brought in transitively.
-
-[source,xml]
-----
-<dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-langchain4j-agent</artifactId>
-</dependency>
-----
-
-With both dependencies in place, a `@RegisterAiService` interface can call Camel tools directly:
-
-[source,java]
-----
-@RegisterAiService
-public interface WeatherAiService {
- String chat(@UserMessage String question);
-}
-----
-
-Any `ai-tool:` route is now callable by the LLM behind `WeatherAiService`. No `toolProvider` attribute or manual bean reference is needed.
-
-==== Tag filtering with `@CamelAiTools`
-
-By default, all registered `ai-tool:` routes are visible to every AI service. When you need different AI services to see different subsets of tools, annotate the service interface with `@CamelAiTools` and specify a tag value that matches the `tags` parameter on your `ai-tool:` routes.
-
-[source,java]
-----
-@RegisterAiService
-@CamelAiTools("weather")
-public interface WeatherAgent {
- String chat(@UserMessage String question);
-}
-
-@RegisterAiService
-@CamelAiTools("support")
-public interface SupportAgent {
- String chat(@UserMessage String question);
-}
-----
-
-With this setup:
-
-* `WeatherAgent` sees only tools tagged with `weather` (plus any untagged tools from the default pool).
-* `SupportAgent` sees only tools tagged with `support` (plus any untagged tools from the default pool).
-* A `@RegisterAiService` without `@CamelAiTools` sees all registered tools regardless of tags.
-
-NOTE: The `@CamelAiTools` value must match a tag declared in the `ai-tool:` endpoint URI (e.g. `from("ai-tool:getWeather?tags=weather&...")`). If the annotation value is blank or does not match any route tag, the AI service will only see untagged tools.
diff --git a/extensions/ai-tool/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/ai-tool/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000000..34ffbf6add
--- /dev/null
+++ b/extensions/ai-tool/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -0,0 +1,36 @@
+#
+# 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.
+#
+
+# This is a generated file. Do not edit directly!
+# To re-generate, run the following command from the top level directory:
+#
+# mvn -N cq:update-quarkus-metadata
+#
+---
+name: "Camel AI Tool"
+description: "Framework-agnostic consumer endpoint that registers a Camel route as an LLM tool in the shared AiToolRegistry"
+metadata:
+ icon-url: "https://raw.githubusercontent.com/apache/camel-website/main/antora-ui-camel/src/img/logo-d.svg"
+ sponsor: "Apache Software Foundation"
+ guide: "https://camel.apache.org/camel-quarkus/latest/reference/extensions/ai-tool.html"
+ categories:
+ - "integration"
+ status: "stable"
+ integrates:
+ - name: "Camel"
+ artifact: "org.apache.camel:camel-base"
+ version: "${camel.version}"
\ No newline at end of file
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 0445b0e37d..bfb301db5e 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -37,6 +37,7 @@
<module>a2a</module>
<module>activemq</module>
<module>activemq6</module>
+ <module>ai-tool</module>
<module>amqp</module>
<module>arangodb</module>
<module>as2</module>
diff --git a/integration-tests/ai-tool/pom.xml b/integration-tests/ai-tool/pom.xml
new file mode 100644
index 0000000000..532b759638
--- /dev/null
+++ b/integration-tests/ai-tool/pom.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-build-parent-it</artifactId>
+ <version>3.39.0-SNAPSHOT</version>
+ <relativePath>../../poms/build-parent-it/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-integration-test-ai-tool</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: AI Tool</name>
+ <description>Integration tests for Camel Quarkus AI Tool extension</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-ai-tool</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy</artifactId>
+ </dependency>
+
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.rest-assured</groupId>
+ <artifactId>rest-assured</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>native</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <properties>
+ <quarkus.native.enabled>true</quarkus.native.enabled>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>virtualDependencies</id>
+ <activation>
+ <property>
+ <name>!noVirtualDependencies</name>
+ </property>
+ </activation>
+ <dependencies>
+ <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory -->
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-ai-tool-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/integration-tests/ai-tool/src/main/java/org/apache/camel/quarkus/component/ai/tool/it/AiToolResource.java b/integration-tests/ai-tool/src/main/java/org/apache/camel/quarkus/component/ai/tool/it/AiToolResource.java
new file mode 100644
index 0000000000..d1a8c895f4
--- /dev/null
+++ b/integration-tests/ai-tool/src/main/java/org/apache/camel/quarkus/component/ai/tool/it/AiToolResource.java
@@ -0,0 +1,137 @@
+/*
+ * 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.quarkus.component.ai.tool.it;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.QueryParam;
+import jakarta.ws.rs.core.MediaType;
+import jakarta.ws.rs.core.Response;
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.component.ai.tool.AiToolExecutor;
+import org.apache.camel.component.ai.tool.AiToolRegistry;
+import org.apache.camel.component.ai.tool.AiToolResult;
+import org.apache.camel.component.ai.tool.AiToolSpec;
+import org.apache.camel.support.DefaultExchange;
+
+@Path("/ai-tool")
+@ApplicationScoped
+public class AiToolResource {
+
+ @Inject
+ CamelContext camelContext;
+
+ @Path("/tools/tag/{tag}")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String getToolsByTag(@PathParam("tag") String tag) {
+ AiToolRegistry registry = AiToolRegistry.getOrCreate(camelContext);
+ Set<AiToolSpec> tools = registry.getToolsByTag(tag);
+ return tools.stream()
+ .map(AiToolSpec::getName)
+ .sorted()
+ .collect(Collectors.joining(","));
+ }
+
+ @Path("/tools/all")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String getAllTools() {
+ AiToolRegistry registry = AiToolRegistry.getOrCreate(camelContext);
+ Set<AiToolSpec> tools = registry.getAllTools();
+ return tools.stream()
+ .map(AiToolSpec::getName)
+ .sorted()
+ .collect(Collectors.joining(","));
+ }
+
+ @Path("/tools/{toolName}/description")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String getToolDescription(@PathParam("toolName") String toolName) {
+ AiToolSpec spec = findTool(toolName);
+ if (spec == null) {
+ return "NOT_FOUND";
+ }
+ return spec.getDescription();
+ }
+
+ @Path("/tools/{toolName}/schema")
+ @GET
+ @Produces(MediaType.APPLICATION_JSON)
+ public String getToolSchema(@PathParam("toolName") String toolName) {
+ AiToolSpec spec = findTool(toolName);
+ if (spec == null) {
+ return "{}";
+ }
+ return spec.getParametersJsonSchema();
+ }
+
+ @Path("/execute/{toolName}")
+ @POST
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response executeTool(
+ @PathParam("toolName") String toolName,
+ @QueryParam("param") java.util.List<String> params) {
+
+ AiToolSpec spec = findTool(toolName);
+ if (spec == null) {
+ return Response.status(404).entity("Tool not found: " + toolName).build();
+ }
+
+ Map<String, Object> arguments = new HashMap<>();
+ if (params != null) {
+ for (String param : params) {
+ String[] parts = param.split("=", 2);
+ if (parts.length == 2) {
+ arguments.put(parts[0], parts[1]);
+ }
+ }
+ }
+
+ Exchange exchange = new DefaultExchange(camelContext);
+ AiToolResult result = AiToolExecutor.execute(spec, arguments, exchange);
+
+ if (result instanceof AiToolResult.Success s) {
+ return Response.ok(s.value()).build();
+ } else if (result instanceof AiToolResult.ArgumentError e) {
+ return Response.status(400).entity(e.message()).build();
+ } else if (result instanceof AiToolResult.ExecutionError e) {
+ return Response.status(500).entity(e.message()).build();
+ }
+ return Response.status(500).entity("Unknown result type").build();
+ }
+
+ private AiToolSpec findTool(String toolName) {
+ AiToolRegistry registry = AiToolRegistry.getOrCreate(camelContext);
+ return registry.getAllTools().stream()
+ .filter(s -> s.getName().equals(toolName))
+ .findFirst()
+ .orElse(null);
+ }
+}
diff --git a/integration-tests/ai-tool/src/main/java/org/apache/camel/quarkus/component/ai/tool/it/AiToolRoutes.java b/integration-tests/ai-tool/src/main/java/org/apache/camel/quarkus/component/ai/tool/it/AiToolRoutes.java
new file mode 100644
index 0000000000..8ea55e4978
--- /dev/null
+++ b/integration-tests/ai-tool/src/main/java/org/apache/camel/quarkus/component/ai/tool/it/AiToolRoutes.java
@@ -0,0 +1,74 @@
+/*
+ * 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.quarkus.component.ai.tool.it;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class AiToolRoutes extends RouteBuilder {
+ @Override
+ public void configure() {
+ from("ai-tool:getWeather?tags=weather"
+ + "&description=Get the current weather for a city"
+ + "¶meter.city=string"
+ + "¶meter.city.description=The city name"
+ + "¶meter.city.required=true"
+ + "¶meter.unit=string"
+ + "¶meter.unit.enum=celsius,fahrenheit")
+ .setBody(simple("Weather in ${header.city}: sunny, 25 ${header.unit}"));
+
+ from("ai-tool:calculate?tags=math"
+ + "&description=Perform a calculation"
+ + "¶meter.a=integer"
+ + "¶meter.a.required=true"
+ + "¶meter.b=integer"
+ + "¶meter.b.required=true"
+ + "¶meter.operation=string"
+ + "¶meter.operation.required=true"
+ + "¶meter.operation.enum=add,subtract,multiply")
+ .choice()
+ .when(simple("${header.operation} == 'add'"))
+ .process(e -> {
+ int a = e.getMessage().getHeader("a", Integer.class);
+ int b = e.getMessage().getHeader("b", Integer.class);
+ e.getMessage().setBody(String.valueOf(a + b));
+ })
+ .when(simple("${header.operation} == 'subtract'"))
+ .process(e -> {
+ int a = e.getMessage().getHeader("a", Integer.class);
+ int b = e.getMessage().getHeader("b", Integer.class);
+ e.getMessage().setBody(String.valueOf(a - b));
+ })
+ .when(simple("${header.operation} == 'multiply'"))
+ .process(e -> {
+ int a = e.getMessage().getHeader("a", Integer.class);
+ int b = e.getMessage().getHeader("b", Integer.class);
+ e.getMessage().setBody(String.valueOf(a * b));
+ })
+ .otherwise()
+ .setBody(constant("Unknown operation"));
+
+ from("ai-tool:greet?"
+ + "description=Greet a user by name"
+ + "¶meter.name=string"
+ + "¶meter.name.required=true")
+ .setBody(simple("Hello, ${header.name}!"));
+
+ from("ai-tool:failingTool?tags=test"
+ + "&description=A tool that always fails")
+ .throwException(new IllegalStateException("Intentional failure"));
+ }
+}
diff --git a/integration-tests/ai-tool/src/test/java/org/apache/camel/quarkus/component/ai/tool/it/AiToolIT.java b/integration-tests/ai-tool/src/test/java/org/apache/camel/quarkus/component/ai/tool/it/AiToolIT.java
new file mode 100644
index 0000000000..4cd2d38739
--- /dev/null
+++ b/integration-tests/ai-tool/src/test/java/org/apache/camel/quarkus/component/ai/tool/it/AiToolIT.java
@@ -0,0 +1,24 @@
+/*
+ * 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.quarkus.component.ai.tool.it;
+
+import io.quarkus.test.junit.QuarkusIntegrationTest;
+
+@QuarkusIntegrationTest
+class AiToolIT extends AiToolTest {
+
+}
diff --git a/integration-tests/ai-tool/src/test/java/org/apache/camel/quarkus/component/ai/tool/it/AiToolTest.java b/integration-tests/ai-tool/src/test/java/org/apache/camel/quarkus/component/ai/tool/it/AiToolTest.java
new file mode 100644
index 0000000000..f1e5e411df
--- /dev/null
+++ b/integration-tests/ai-tool/src/test/java/org/apache/camel/quarkus/component/ai/tool/it/AiToolTest.java
@@ -0,0 +1,159 @@
+/*
+ * 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.quarkus.component.ai.tool.it;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@QuarkusTest
+class AiToolTest {
+
+ @Test
+ void toolRegistrationByTag() {
+ RestAssured.get("/ai-tool/tools/tag/weather")
+ .then()
+ .statusCode(200)
+ .body(containsString("getWeather"));
+
+ RestAssured.get("/ai-tool/tools/tag/math")
+ .then()
+ .statusCode(200)
+ .body(containsString("calculate"));
+ }
+
+ @Test
+ void taglessToolInDefaultPool() {
+ RestAssured.get("/ai-tool/tools/all")
+ .then()
+ .statusCode(200)
+ .body(containsString("greet"));
+ }
+
+ @Test
+ void defaultPoolMergedWithTaggedTools() {
+ RestAssured.get("/ai-tool/tools/tag/weather")
+ .then()
+ .statusCode(200)
+ .body(containsString("greet"));
+ }
+
+ @Test
+ void allToolsReturnsEveryRegisteredTool() {
+ String tools = RestAssured.get("/ai-tool/tools/all")
+ .then()
+ .statusCode(200)
+ .extract().asString();
+
+ assertTrue(tools.contains("getWeather"), "Expected getWeather in: " + tools);
+ assertTrue(tools.contains("calculate"), "Expected calculate in: " + tools);
+ assertTrue(tools.contains("greet"), "Expected greet in: " + tools);
+ assertTrue(tools.contains("failingTool"), "Expected failingTool in: " + tools);
+ }
+
+ @Test
+ void toolDescription() {
+ RestAssured.get("/ai-tool/tools/getWeather/description")
+ .then()
+ .statusCode(200)
+ .body(is("Get the current weather for a city"));
+ }
+
+ @Test
+ void toolSchema() {
+ String schema = RestAssured.get("/ai-tool/tools/getWeather/schema")
+ .then()
+ .statusCode(200)
+ .extract().asString();
+
+ assertTrue(schema.contains("\"city\""), "Expected city in schema: " + schema);
+ assertTrue(schema.contains("\"unit\""), "Expected unit in schema: " + schema);
+ assertTrue(schema.contains("\"string\""), "Expected string type in schema: " + schema);
+ }
+
+ @Test
+ void executeWeatherTool() {
+ RestAssured.given()
+ .queryParam("param", "city=Prague")
+ .queryParam("param", "unit=celsius")
+ .post("/ai-tool/execute/getWeather")
+ .then()
+ .statusCode(200)
+ .body(containsString("Prague"))
+ .body(containsString("celsius"));
+ }
+
+ @Test
+ void executeCalculateTool() {
+ RestAssured.given()
+ .queryParam("param", "a=10")
+ .queryParam("param", "b=3")
+ .queryParam("param", "operation=add")
+ .post("/ai-tool/execute/calculate")
+ .then()
+ .statusCode(200)
+ .body(is("13"));
+
+ RestAssured.given()
+ .queryParam("param", "a=10")
+ .queryParam("param", "b=3")
+ .queryParam("param", "operation=multiply")
+ .post("/ai-tool/execute/calculate")
+ .then()
+ .statusCode(200)
+ .body(is("30"));
+ }
+
+ @Test
+ void executeGreetTool() {
+ RestAssured.given()
+ .queryParam("param", "name=Alice")
+ .post("/ai-tool/execute/greet")
+ .then()
+ .statusCode(200)
+ .body(is("Hello, Alice!"));
+ }
+
+ @Test
+ void executeMissingRequiredParam() {
+ RestAssured.given()
+ .post("/ai-tool/execute/getWeather")
+ .then()
+ .statusCode(400)
+ .body(containsString("city"));
+ }
+
+ @Test
+ void executeFailingTool() {
+ RestAssured.given()
+ .post("/ai-tool/execute/failingTool")
+ .then()
+ .statusCode(500);
+ }
+
+ @Test
+ void executeNonExistentTool() {
+ RestAssured.given()
+ .post("/ai-tool/execute/nonExistent")
+ .then()
+ .statusCode(404);
+ }
+}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index ce58500c83..8ffee5a4dd 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -52,7 +52,6 @@
<module>activemq</module>
<module>activemq6</module>
<module>ai-tool</module>
- <module>ai-tool-langchain4j</module>
<module>amqp</module>
<module>arangodb</module>
<module>as2</module>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index a834a19128..620ae65db4 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -3536,6 +3536,16 @@
<artifactId>camel-quarkus-activemq6-deployment</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-ai-tool</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-ai-tool-deployment</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-amqp</artifactId>
diff --git a/poms/bom/src/main/generated/flattened-full-pom.xml b/poms/bom/src/main/generated/flattened-full-pom.xml
index 51def87a98..0b6b1c1248 100644
--- a/poms/bom/src/main/generated/flattened-full-pom.xml
+++ b/poms/bom/src/main/generated/flattened-full-pom.xml
@@ -3431,6 +3431,16 @@
<artifactId>camel-quarkus-activemq6-deployment</artifactId>
<version>3.39.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-ai-tool</artifactId>
+ <version>3.39.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-ai-tool-deployment</artifactId>
+ <version>3.39.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-amqp</artifactId>
diff --git a/poms/bom/src/main/generated/flattened-reduced-pom.xml b/poms/bom/src/main/generated/flattened-reduced-pom.xml
index cf6fb108da..7db893ec53 100644
--- a/poms/bom/src/main/generated/flattened-reduced-pom.xml
+++ b/poms/bom/src/main/generated/flattened-reduced-pom.xml
@@ -4774,6 +4774,16 @@
<artifactId>camel-quarkus-activemq6-deployment</artifactId>
<version>3.39.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-ai-tool</artifactId>
+ <version>3.39.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-ai-tool-deployment</artifactId>
+ <version>3.39.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-amqp</artifactId>
diff --git a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml
index 1612d90af1..59a3fb8a2d 100644
--- a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml
+++ b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml
@@ -4774,6 +4774,16 @@
<artifactId>camel-quarkus-activemq6-deployment</artifactId>
<version>3.39.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-ai-tool</artifactId>
+ <version>3.39.0-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-ai-tool-deployment</artifactId>
+ <version>3.39.0-SNAPSHOT</version>
+ </dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-amqp</artifactId>
diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml
index 97b679b994..a4df390265 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -232,7 +232,6 @@ group-11:
- xslt-saxon
group-12:
- ai-tool
- - ai-tool-langchain4j
- aws2-grouped
- csimple
- github2