This is an automated email from the ASF dual-hosted git repository.
JiriOndrusek pushed a commit to branch camel-main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/camel-main by this push:
new f95d66ae8c Add camel-quarkus-ai-tool extension
f95d66ae8c is described below
commit f95d66ae8c84de0041c2648c959dd9ee3f589c5c
Author: Jiri Ondrusek <[email protected]>
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 <[email protected]>
---
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 | 94 ++++++++++++
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 | 43 ++++++
.../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, 982 insertions(+)
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
new file mode 100644
index 0000000000..16920abb9a
--- /dev/null
+++ b/docs/modules/ROOT/pages/reference/extensions/ai-tool.adoc
@@ -0,0 +1,94 @@
+// Do not edit directly!
+// This file was generated by
camel-quarkus-maven-plugin:update-extension-doc-page
+[id="extensions-ai-tool"]
+= AI Tool
+:linkattrs:
+:cq-artifact-id: camel-quarkus-ai-tool
+:cq-native-supported: true
+:cq-status: Stable
+:cq-status-deprecation: Stable
+:cq-description: Framework-agnostic consumer endpoint that registers a Camel
route as an LLM tool in the shared AiToolRegistry.
+:cq-deprecated: false
+:cq-jvm-since: 3.39.0
+:cq-native-since: 3.39.0
+
+ifeval::[{doc-show-badges} == true]
+[.badges]
+[.badge-key]##JVM since##[.badge-supported]##3.39.0## [.badge-key]##Native
since##[.badge-supported]##3.39.0##
+endif::[]
+
+Framework-agnostic consumer endpoint that registers a Camel route as an LLM
tool in the shared AiToolRegistry.
+
+[id="extensions-ai-tool-whats-inside"]
+== What's inside
+
+* xref:{cq-camel-components}::ai-tool-component.adoc[AI Tool component], URI
syntax: `ai-tool:toolName`
+
+Please refer to the above link for usage and configuration details.
+
+[id="extensions-ai-tool-maven-coordinates"]
+== Maven coordinates
+
+https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-ai-tool[Create
a new project with this extension on {link-quarkus-code-generator},
window="_blank"]
+
+Or add the coordinates to your existing project:
+
+[source,xml]
+----
+<dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-ai-tool</artifactId>
+</dependency>
+----
+ifeval::[{doc-show-user-guide-link} == true]
+Check the xref:user-guide/index.adoc[User guide] for more information about
writing Camel Quarkus applications.
+endif::[]
+
+[id="extensions-ai-tool-usage"]
+== Usage
+The `ai-tool` component is a framework-agnostic consumer endpoint that
registers Camel routes as LLM-callable tools in a shared `AiToolRegistry`.
Framework-specific extensions (such as `camel-quarkus-langchain4j-tools`,
`camel-quarkus-openai`) discover and invoke these tools at runtime.
+
+[id="extensions-ai-tool-usage-defining-a-tool"]
+=== Defining a tool
+
+Use the `ai-tool` consumer endpoint to register a route as an AI tool. Tool
parameters are declared via URI options.
+
+[source,java]
+----
+public class MyRoutes 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("Sunny in ${header.city}, temperature in
${header.unit}"));
+ }
+}
+----
+
+Arguments passed by the LLM are set as exchange headers (e.g.
`${header.city}`).
+
+[id="extensions-ai-tool-usage-tag-based-grouping"]
+=== Tag-based grouping
+
+Tools can be grouped by tags. AI producer endpoints use tags to discover a
subset of available tools.
+
+A tool with no tags is placed in a default pool and is available to all tag
queries.
+
+[source,java]
+----
+// Tagged tool — only visible to producers querying the "support" tag
+from("ai-tool:lookupOrder?tags=support&description=Look up order status"
+ + "¶meter.orderId=string¶meter.orderId.required=true")
+ .to("sql:SELECT status FROM orders WHERE id = :#${header.orderId}");
+
+// Untagged tool — available to all producers
+from("ai-tool:greet?description=Greet a user"
+ + "¶meter.name=string¶meter.name.required=true")
+ .setBody(simple("Hello, ${header.name}!"));
+----
+
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
new file mode 100644
index 0000000000..677f114f7c
--- /dev/null
+++ b/extensions/ai-tool/runtime/src/main/doc/usage.adoc
@@ -0,0 +1,43 @@
+The `ai-tool` component is a framework-agnostic consumer endpoint that
registers Camel routes as LLM-callable tools in a shared `AiToolRegistry`.
Framework-specific extensions (such as `camel-quarkus-langchain4j-tools`,
`camel-quarkus-openai`) discover and invoke these tools at runtime.
+
+=== Defining a tool
+
+Use the `ai-tool` consumer endpoint to register a route as an AI tool. Tool
parameters are declared via URI options.
+
+[source,java]
+----
+public class MyRoutes 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("Sunny in ${header.city}, temperature in
${header.unit}"));
+ }
+}
+----
+
+Arguments passed by the LLM are set as exchange headers (e.g.
`${header.city}`).
+
+=== Tag-based grouping
+
+Tools can be grouped by tags. AI producer endpoints use tags to discover a
subset of available tools.
+
+A tool with no tags is placed in a default pool and is available to all tag
queries.
+
+[source,java]
+----
+// Tagged tool — only visible to producers querying the "support" tag
+from("ai-tool:lookupOrder?tags=support&description=Look up order status"
+ + "¶meter.orderId=string¶meter.orderId.required=true")
+ .to("sql:SELECT status FROM orders WHERE id = :#${header.orderId}");
+
+// Untagged tool — available to all producers
+from("ai-tool:greet?description=Greet a user"
+ + "¶meter.name=string¶meter.name.required=true")
+ .setBody(simple("Hello, ${header.name}!"));
+----
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 b29781f585..8ffee5a4dd 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -51,6 +51,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/poms/bom/pom.xml b/poms/bom/pom.xml
index bfd0533954..ef15e3593e 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -3545,6 +3545,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 d89530db53..7c84dc4712 100644
--- a/poms/bom/src/main/generated/flattened-full-pom.xml
+++ b/poms/bom/src/main/generated/flattened-full-pom.xml
@@ -3440,6 +3440,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 86fb889936..4ff8f176f5 100644
--- a/poms/bom/src/main/generated/flattened-reduced-pom.xml
+++ b/poms/bom/src/main/generated/flattened-reduced-pom.xml
@@ -4773,6 +4773,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 b8075caa75..41e0531663 100644
--- a/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml
+++ b/poms/bom/src/main/generated/flattened-reduced-verbose-pom.xml
@@ -4773,6 +4773,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 6eecf4224a..a4df390265 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -231,6 +231,7 @@ group-11:
- xml-grouped
- xslt-saxon
group-12:
+ - ai-tool
- aws2-grouped
- csimple
- github2