Federico Mariani created CAMEL-23950:
----------------------------------------
Summary: camel-langchain4j-agent: complete AgentConfiguration
coverage of the AiServices builder
Key: CAMEL-23950
URL: https://issues.apache.org/jira/browse/CAMEL-23950
Project: Camel
Issue Type: Improvement
Components: camel-langchain4j-agent
Reporter: Federico Mariani
Follow-up to CAMEL-23928, which added {{maxToolCallingRoundTrips}},
{{hallucinatedToolNameStrategy}}, tool error handlers,
{{compensateOnToolErrors}} and the {{aiServicesCustomizer}} escape hatch.
Comparing {{AgentConfiguration}} against the full {{AiServices}} builder
surface at LangChain4j 1.17.2, the following knobs are missing *and matter in a
Camel context*:
* *Guardrail instances*: {{inputGuardrails(List<InputGuardrail>)}} /
{{outputGuardrails(...)}} plus {{inputGuardrailsConfig}} /
{{outputGuardrailsConfig}}. Today only guardrail *classes* are supported, which
LangChain4j instantiates via no-arg constructor — in a bean-centric Camel
application (Spring/Quarkus DI) this blocks any guardrail that needs
configuration (thresholds, wordlists, vault-sourced patterns) or injected
collaborators, and it is a prerequisite for CAMEL-23344 (route-based guardrails
need a {{CamelContext}}-aware instance).
* {{beforeToolExecution}} / {{afterToolExecution}} consumers — the natural hook
for per-tool-call logging, Camel events, Micrometer metrics and OTel spans;
foundation for CAMEL-23861.
* {{maxSequentialToolsInvocations}} — companion cost-control cap to the
already-exposed {{maxToolCallingRoundTrips}}; trivial to add.
* {{immediateReturnToolNames}} — lets a Camel route tool produce the *final*
answer without a closing LLM round trip (saves one model call per invocation
for deterministic tools).
Deliberately *not* exposed (reachable via the existing {{aiServicesCustomizer}}
escape hatch; document this in the component docs):
* {{toolSearchStrategy}} — overlaps with the component's own tool-search
mechanism ({{exposed=false}} + toolSearchTool);
* {{storeRetrievedContentInChatMemory}} — niche RAG-memory flag;
* {{AiServiceListener}} registration — users can already attach
{{ChatModelListener}}s to the {{ChatModel}} bean they inject.
Out of scope here: {{executeToolsConcurrently(Executor)}} — tracked in a
dedicated issue together with the tool-executor exchange-safety work that
permits it (see "support executeToolsConcurrently").
Also: document (Javadoc) that an {{aiServicesCustomizer}} setting
{{chatRequestTransformer}} silently replaces the transformer installed by
{{configureBuilder}} for {{responseFormat}}, breaking
{{jsonSchema}}/{{outputClass}} structured output.
Wiring pattern: same as CAMEL-23928 — null-guarded application in
{{AbstractAgent.configureBuilder()}} plus unit tests in the style of
{{AgentConfigurationTest}}.
Related: CAMEL-23928, CAMEL-23929, CAMEL-23344, CAMEL-23861.
_This issue was drafted by Claude Code on behalf of Federico Mariani._
--
This message was sent by Atlassian Jira
(v8.20.10#820010)