Claus Ibsen created CAMEL-23704:
-----------------------------------
Summary: camel-ai - Use correlated exchange copy for multi-tool
invocations in langchain4j-tools
Key: CAMEL-23704
URL: https://issues.apache.org/jira/browse/CAMEL-23704
Project: Camel
Issue Type: Improvement
Components: camel-langchain4j-tools
Reporter: Claus Ibsen
Follow-up to CAMEL-21937.
Currently, the LangChain4jToolsProducer.invokeTools() method reuses the same
Exchange object across all tool invocations in a single LLM response.
CAMEL-21937 fixed the most critical issue (ROUTE_STOP flag leaking between
tools), but the shared exchange still allows:
* Exchange body from one tool leaking to the next tool
* Tool parameter headers accumulating across tool invocations
* Exceptions from one tool affecting subsequent tools
The proper fix is to create a correlated exchange copy (similar to how
multicast/splitter work) for each tool invocation. Each tool route would
execute on its own exchange, and the result would be collected from that
exchange. This fully isolates tool executions and prevents any state leakage
between tools.
This also aligns with how other Camel EIPs handle similar fan-out patterns
where multiple routes process the same exchange independently.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)