Zineb Bendhiba created CAMEL-23649:
--------------------------------------
Summary: camel-langchain4j-agent: Allow Camel to create the agent
internally from AgentConfiguration
Key: CAMEL-23649
URL: https://issues.apache.org/jira/browse/CAMEL-23649
Project: Camel
Issue Type: New Feature
Reporter: Zineb Bendhiba
Assignee: Zineb Bendhiba
Currently, users must instantiate the Agent themselves and register it as a
bean before the route starts:
{code:java}
AgentConfiguration config = new AgentConfiguration()
.withChatModel(chatModel);
Agent agent = new AgentWithoutMemory(config); // or AgentWithMemory
context.getRegistry().bind("myAgent", agent);
{code}
The component never creates an agent itself. The AgentFactory interface exists
as an escape hatch for dynamic creation, but it still pushes the responsibility
back to the user and requires implementing a custom interface.
*Proposed change:*
Add support for agentConfiguration=#myConfig as a URI param. The producer
decides which agent type to create based on the configuration:
- chatMemoryProvider is set: creates AgentWithMemory
- Otherwise: creates AgentWithoutMemory
The existing agent=#myBean URI param stays supported for users who need a
custom agent implementation.
This issue is a blocker for [adding endpoint-level structured output support
(jsonSchema URI param)|https://issues.apache.org/jira/browse/CAMEL-23642]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)