Skip to content

667 langchain4j tools - #720

Open
milosF8 wants to merge 49 commits into
nextfrom
667-langchain4j-tools
Open

667 langchain4j tools#720
milosF8 wants to merge 49 commits into
nextfrom
667-langchain4j-tools

Conversation

@milosF8

@milosF8 milosF8 commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Milozmih and others added 30 commits August 4, 2026 10:10
# Conflicts:
#	dil/src/main/java/org/assimbly/dil/blocks/connections/ai/LangChain4jAgentConnection.java
#	dil/src/main/resources/kamelets/langchain4jagent-action.kamelet.yaml
skin27 and others added 17 commits September 1, 2026 00:39
# Conflicts:
#	camelBase/pom.xml
#	dil/pom.xml
#	dil/src/main/resources/kamelets/langchain4jagent-action.kamelet.yaml
# Conflicts:
#	camelBase/pom.xml
#	commonBase/pom.xml
#	dil/pom.xml
#	dil/src/main/java/org/assimbly/dil/blocks/connections/ai/LangChain4jAgentConnection.java
#	dil/src/main/resources/kamelets/langchain4j-agent-action.kamelet.yaml
#	dil/src/main/resources/kamelets/langchain4j-web-search-action.kamelet.yaml
#	dil/src/main/resources/kamelets/langchain4jagent-action.kamelet.yaml
#	pom.xml
@milosF8
milosF8 requested a review from skin27 September 2, 2026 12:58
@milosF8 milosF8 self-assigned this Sep 2, 2026
@codacy-production

codacy-production Bot commented Sep 2, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 9 complexity · 7 duplication

Metric Results
Complexity 9
Duplication 7

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

.maxMessages(100)
.chatMemoryStore(chatMemoryStore)
.build();
java.util.Map<Object, dev.langchain4j.memory.ChatMemory> memories = new java.util.concurrent.ConcurrentHashMap<>();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible memory leak here:

The new implementation does:

memories.computeIfAbsent(memoryId, id -> ...)

but I don't see any eviction/removal mechanism. Therefore every distinct memoryId encountered by the agent remains in the ConcurrentHashMap for the lifetime of the connection.

@@ -0,0 +1,20 @@
apiVersion: "camel.apache.org/v1"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this Kamelet need, or just used for local testing?

@@ -0,0 +1,64 @@
package org.assimbly.dil.blocks.connections.broker;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this in the broker package? Probably should be in the ai package like the other ai connections

log.debug("Imaps connection will be configured on the component");

case "langchain4j-agent" ->
case "langchain4j-agent", "langchain4jagent" ->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why support both naming convnentions. Better choose one (that fits the other kamelets)

new RabbitMQConnection(context, decryptedProperties, connectionId, "spring-rabbitmq").start();

case "springai" ->
case "springai-chat", "springaichat" ->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why support both naming convnentions. Better choose one (that fits the other kamelets)

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.

@pedrocatalao pedrocatalao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar with how this works but here goes, probably worth checking:

  • The camel-log dependency was deleted. In camelBase/pom.xml the line for camel-log was replaced by camel-langchain4j-agent, was that by accident?

  • Messages without a memory ID now share one conversation. Before, a missing memoryId fell back to the exchange ID but now falls back to "default".

  • The memory leak fix seems incomplete. Evicting a ChatMemory from the new bounded map doesn't clear its messages from the shared InMemoryChatMemoryStore. The store is a plain map that only removes an entry when clear() is called on the memory. So the old ids' messages still stay forever, just via a different object. The eviction hook needs to call clear() on the evicted memory.

Also got this when I asked AI to check:

  • Unrelated changes bundled in. Switching the Gemini model on for returnThinking and sendThinking, changing the default model name, and adding camel-mustache have nothing to do with tools. They change cost and behaviour for every existing agent user. Ask to split them out or justify them. Also ask them to confirm "gemini-3.6-flash" is a real model name.
  • Tavily library version is stale. It's pinned to 0.36.2 while the rest of LangChain4j is 1.19.0. The matching release is 1.19.0-beta29. Mixing 0.x and 1.x LangChain4j artifacts is a classpath problem waiting to happen.
  • Two names for the same setting, again. The agent connection reads websearchapikey and falls back to tavilyapikey. Raymond already asked for one naming convention. Same for the dash-stripping template lookup in RouteTemplate, which exists only so both langchain4j-agent and langchain4jagent resolve. Pick one name and delete the fallback code.
  • Web search is wired twice. There's a standalone web-search connection and kamelet, and separately the agent connection builds its own Tavily engine from an API key. The agent should reuse the registered web-search connection bean instead of duplicating the setup.
  • The weather tool is a demo. It always answers "sunny, 25°C". Same question Raymond asked about the hello tool: is it meant to ship, or is it test scaffolding? If it ships, name and describe it as a sample.

Finally:

  • Does this need any unit tests? (maybe not in scope)
  • There are merge conflicts in the PR that need to be resolved carefully before a final review.

@pedrocatalao pedrocatalao linked an issue Sep 3, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

implementation of tool calling in Langchain4j-Agent

5 participants