Interface Langchain4jAgentComponentBuilderFactory.Langchain4jAgentComponentBuilder
- All Superinterfaces:
ComponentBuilder<org.apache.camel.component.langchain4j.agent.LangChain4jAgentComponent>
- All Known Implementing Classes:
Langchain4jAgentComponentBuilderFactory.Langchain4jAgentComponentBuilderImpl
- Enclosing interface:
Langchain4jAgentComponentBuilderFactory
public static interface Langchain4jAgentComponentBuilderFactory.Langchain4jAgentComponentBuilder
extends ComponentBuilder<org.apache.camel.component.langchain4j.agent.LangChain4jAgentComponent>
Builder for the LangChain4j Agent component.
-
Method Summary
Modifier and TypeMethodDescriptionagent(org.apache.camel.component.langchain4j.agent.api.Agent agent) The agent to use for the component.agentConfiguration(org.apache.camel.component.langchain4j.agent.api.AgentConfiguration agentConfiguration) AgentConfiguration used by Camel to create the agent internally.agentFactory(org.apache.camel.component.langchain4j.agent.api.AgentFactory agentFactory) The agent factory to use for creating agents if no Agent is provided.autowiredEnabled(boolean autowiredEnabled) Whether autowiring is enabled.configuration(org.apache.camel.component.langchain4j.agent.LangChain4jAgentConfiguration configuration) The configuration.jsonSchema(String jsonSchema) JSON schema for structured output validation.lazyStartProducer(boolean lazyStartProducer) Whether the producer should be started lazy (on the first message).mcpClients(List<dev.langchain4j.mcp.client.McpClient> mcpClients) Pre-built MCP (Model Context Protocol) client instances for external tool integration.MCP server definitions in the form of mcpServer..=.outputClass(Class<Object> outputClass) Java class to use for structured output.Tags for discovering and calling Camel route tools.Methods inherited from interface ComponentBuilder
build, build, doSetProperty, register
-
Method Details
-
agent
default Langchain4jAgentComponentBuilderFactory.Langchain4jAgentComponentBuilder agent(org.apache.camel.component.langchain4j.agent.api.Agent agent) The agent to use for the component. The option is a: <code>org.apache.camel.component.langchain4j.agent.api.Agent</code> type. Group: producer- Parameters:
agent- the value to set- Returns:
- the dsl builder
-
agentConfiguration
default Langchain4jAgentComponentBuilderFactory.Langchain4jAgentComponentBuilder agentConfiguration(org.apache.camel.component.langchain4j.agent.api.AgentConfiguration agentConfiguration) AgentConfiguration used by Camel to create the agent internally. When set, Camel creates an AgentWithMemory if a ChatMemoryProvider is configured, otherwise an AgentWithoutMemory. If an agentFactory is also configured, the factory takes precedence. The option is a: <code>org.apache.camel.component.langchain4j.agent.api.AgentConfiguration</code> type. Group: producer- Parameters:
agentConfiguration- the value to set- Returns:
- the dsl builder
-
agentFactory
default Langchain4jAgentComponentBuilderFactory.Langchain4jAgentComponentBuilder agentFactory(org.apache.camel.component.langchain4j.agent.api.AgentFactory agentFactory) The agent factory to use for creating agents if no Agent is provided. The option is a: <code>org.apache.camel.component.langchain4j.agent.api.AgentFactory</code> type. Group: producer- Parameters:
agentFactory- the value to set- Returns:
- the dsl builder
-
configuration
default Langchain4jAgentComponentBuilderFactory.Langchain4jAgentComponentBuilder configuration(org.apache.camel.component.langchain4j.agent.LangChain4jAgentConfiguration configuration) The configuration. The option is a: <code>org.apache.camel.component.langchain4j.agent.LangChain4jAgentConfiguration</code> type. Group: producer- Parameters:
configuration- the value to set- Returns:
- the dsl builder
-
jsonSchema
default Langchain4jAgentComponentBuilderFactory.Langchain4jAgentComponentBuilder jsonSchema(String jsonSchema) JSON schema for structured output validation. Only supported in inline agent creation mode: agentConfiguration must be set and neither agent nor agentFactory may be configured. Mutually exclusive with outputClass. This option can also be loaded from an existing file, by prefixing with file: or classpath: followed by the location of the file. The option is a: <code>java.lang.String</code> type. Group: producer- Parameters:
jsonSchema- the value to set- Returns:
- the dsl builder
-
lazyStartProducer
default Langchain4jAgentComponentBuilderFactory.Langchain4jAgentComponentBuilder lazyStartProducer(boolean lazyStartProducer) Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel's routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. The option is a: <code>boolean</code> type. Default: false Group: producer- Parameters:
lazyStartProducer- the value to set- Returns:
- the dsl builder
-
outputClass
default Langchain4jAgentComponentBuilderFactory.Langchain4jAgentComponentBuilder outputClass(Class<Object> outputClass) Java class to use for structured output. Camel derives the JSON schema from the class and instructs the model to produce matching JSON; the response body is left as a raw JSON string. Only supported in inline agent creation mode: agentConfiguration must be set and neither agent nor agentFactory may be configured. The class must be a POJO with public fields or getters; simple types, enums, and collections are not supported. Mutually exclusive with jsonSchema. The option is a: <code>java.lang.Class<java.lang.Object></code> type. Group: producer- Parameters:
outputClass- the value to set- Returns:
- the dsl builder
-
tags
Tags for discovering and calling Camel route tools. The option is a: <code>java.lang.String</code> type. Group: producer- Parameters:
tags- the value to set- Returns:
- the dsl builder
-
autowiredEnabled
default Langchain4jAgentComponentBuilderFactory.Langchain4jAgentComponentBuilder autowiredEnabled(boolean autowiredEnabled) Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. The option is a: <code>boolean</code> type. Default: true Group: advanced- Parameters:
autowiredEnabled- the value to set- Returns:
- the dsl builder
-
mcpClients
default Langchain4jAgentComponentBuilderFactory.Langchain4jAgentComponentBuilder mcpClients(List<dev.langchain4j.mcp.client.McpClient> mcpClients) Pre-built MCP (Model Context Protocol) client instances for external tool integration. Reference beans from the registry, e.g., #myMcpClient1,#myMcpClient2. The option is a: <code>java.util.List<dev.langchain4j.mcp.client.McpClient></code> type. Group: advanced- Parameters:
mcpClients- the value to set- Returns:
- the dsl builder
-
mcpServer
default Langchain4jAgentComponentBuilderFactory.Langchain4jAgentComponentBuilder mcpServer(Map<String, Object> mcpServer) MCP server definitions in the form of mcpServer..=. Supported properties: transportType (stdio, http, streamableHttp, or sse, default: stdio), command (comma-separated, for stdio), url (for http/sse), environment.= (for stdio), timeout (in seconds, default: 60), logRequests, logResponses, oauthProfile (OAuth profile for HTTP auth, requires camel-oauth). This is a multi-value option with prefix: mcpServer. The option is a: <code>java.util.Map<java.lang.String, java.lang.Object></code> type. Group: advanced- Parameters:
mcpServer- the value to set- Returns:
- the dsl builder
-