You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "JiriOndrusek (via GitHub)" <gi...@apache.org> on 2026/08/03 11:26:54 UTC

[PR] [quarkus-main] Fixes #8836: Don't silently use memory on agents with ql4j [camel-quarkus]

JiriOndrusek opened a new pull request, #8946:
URL: https://github.com/apache/camel-quarkus/pull/8946

   fixes https://github.com/apache/camel-quarkus/issues/8836
   requires https://github.com/quarkiverse/quarkus-langchain4j/pull/2722 and https://github.com/quarkiverse/quarkus-langchain4j/pull/2725 
   
   When Quarkus LangChain4j is on the classpath with a default ChatModel configured, QL4J's AiServicesProcessor discovers AiAgentWithoutMemoryService and creates an implied AI service registration that injects a ChatMemoryProvider, silently making the stateless agent stateful.
   
   Add a @BuildStep that produces ExcludeFromImpliedAiServiceBuildItem for AiAgentWithoutMemoryService, preventing QL4J from registering it as an implied AI service. The QL4J side is handled by quarkiverse/quarkus-langchain4j#2722.
   
   <!-- Uncomment and fill this section if your PR is not trivial
   [ ] An issue should be filed for the change unless this is a trivial change (fixing a typo or similar). One issue should ideally be fixed by not more than one commit and the other way round, each commit should fix just one issue, without pulling in other changes.
   [ ] Each commit in the pull request should have a meaningful and properly spelled subject line and body. Copying the title of the associated issue is typically enough. Please include the issue number in the commit message prefixed by #.
   [ ] The pull request description should explain what the pull request does, how, and why. If the info is available in the associated issue or some other external document, a link is enough.
   [ ] Phrases like Fix #<issueNumber> or Fixes #<issueNumber> will auto-close the named issue upon merging the pull request. Using them is typically a good idea.
   [ ] Please run mvn process-resources -Pformat (and amend the changes if necessary) before sending the pull request.
   [ ] Contributor guide is your good friend: https://camel.apache.org/camel-quarkus/latest/contributor-guide.html
   -->


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fixes #8836: Don't silently use memory on agents with ql4j [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton closed pull request #8946: Fixes #8836: Don't silently use memory on agents with ql4j
URL: https://github.com/apache/camel-quarkus/pull/8946


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fixes #8836: Don't silently use memory on agents with ql4j [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on code in PR #8946:
URL: https://github.com/apache/camel-quarkus/pull/8946#discussion_r3813088573


##########
extensions-support/langchain4j/deployment/pom.xml:
##########
@@ -52,6 +52,11 @@
             <artifactId>quarkus-junit-internal</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>io.quarkiverse.langchain4j</groupId>
+            <artifactId>quarkus-langchain4j-core-deployment</artifactId>
+            <optional>true</optional>
+        </dependency>

Review Comment:
   `<optional>true</optional>` can't work here.
   
   If you run a test where QL4J is not present like `langchain4j-agent`, then you get:
   
   ```
   ClassNotFoundException: io.quarkiverse.langchain4j.deployment.ExcludeFromImpliedAiServiceBuildItem
   ```
   
   The only way around it is to make the dependency non-optional. But then you'd need to also make the runtime dependency also non-optional. That'd mean QL4J is always on the runtime classpath whether you want it or not.



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fixes #8836: Don't silently use memory on agents with ql4j [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on code in PR #8946:
URL: https://github.com/apache/camel-quarkus/pull/8946#discussion_r3813094701


##########
extensions-support/langchain4j/runtime/pom.xml:
##########
@@ -70,6 +70,11 @@
             <artifactId>nativeimage</artifactId>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>io.quarkiverse.langchain4j</groupId>
+            <artifactId>quarkus-langchain4j-core</artifactId>
+            <optional>true</optional>
+        </dependency>

Review Comment:
   Can be removed because it's already declared.



##########
extensions-support/langchain4j/deployment/pom.xml:
##########
@@ -52,6 +52,11 @@
             <artifactId>quarkus-junit-internal</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>io.quarkiverse.langchain4j</groupId>
+            <artifactId>quarkus-langchain4j-core-deployment</artifactId>
+            <optional>true</optional>
+        </dependency>

Review Comment:
   `<optional>true</optional>` can't work here.
   
   If you run a test where QL4J is not present like `langchain4j-agent`, then you get:
   
   ```
   ClassNotFoundException: io.quarkiverse.langchain4j.deployment.ExcludeFromImpliedAiServiceBuildItem
   ```
   
   The only way around it is to make the dependency non-optional. But then you'd need to also make the runtime dependency also non-optional. That'd mean the QL4J is always on the runtime classpath whether you want it or not.



##########
extensions-support/langchain4j/pom.xml:
##########
@@ -30,6 +30,18 @@
     <name>Camel Quarkus :: Support :: Langchain4j</name>
     <packaging>pom</packaging>
 
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>io.quarkiverse.langchain4j</groupId>
+                <artifactId>quarkus-langchain4j-bom</artifactId>
+                <version>${quarkiverse-langchain4j.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>

Review Comment:
   This is probably to get the `quarkus-langchain4j-core-deployment` artifact. We could remove this BOM import and just add the dependency into the CQ bom like we did for the core runtime dependency.



##########
extensions-support/langchain4j/deployment/src/main/java/org/apache/camel/quarkus/component/support/langchain4j/deployment/SupportQuarkusLangchain4jProcessor.java:
##########
@@ -253,6 +254,16 @@ void configureCamelAiToolTags(
                 .build());
     }
 
+    @BuildStep
+    void excludeCamelAgentInterfacesFromImpliedRegistration(
+            CombinedIndexBuildItem combinedIndex,
+            BuildProducer<ExcludeFromImpliedAiServiceBuildItem> excludedFromImplied) {
+        String agentWithoutMemory = "org.apache.camel.component.langchain4j.agent.api.AiAgentWithoutMemoryService";

Review Comment:
   Maybe we'd also want to include `AiAgentWithMemoryService`. Not sure what the consequences would be.



-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fixes #8836: Don't silently use memory on agents with ql4j [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on PR #8946:
URL: https://github.com/apache/camel-quarkus/pull/8946#issuecomment-5342055990

   Will close / reopen the PR to try and kickstart CI.


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fixes #8836: Don't silently use memory on agents with ql4j [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton closed pull request #8946: Fixes #8836: Don't silently use memory on agents with ql4j
URL: https://github.com/apache/camel-quarkus/pull/8946


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Fixes #8836: Don't silently use memory on agents with ql4j [camel-quarkus]

Posted by "jamesnetherton (via GitHub)" <gi...@apache.org>.
jamesnetherton commented on PR #8946:
URL: https://github.com/apache/camel-quarkus/pull/8946#issuecomment-5694712899

   Superseded by https://github.com/apache/camel-quarkus/pull/9161.


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org