LangChain4j Agent
LangChain4j Agent component
What’s inside
-
LangChain4j Agent component, URI syntax:
langchain4j-agent:agentId
Please refer to the above links for usage and configuration details.
Maven coordinates
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-langchain4j-agent-starter</artifactId>
</dependency> Spring Boot Auto-Configuration
The starter supports 12 options, which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
camel.component.langchain4j-agent.agent | The agent to use for the component. The option is a org.apache.camel.component.langchain4j.agent.api.Agent type. | Agent | |
camel.component.langchain4j-agent.agent-configuration | 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 org.apache.camel.component.langchain4j.agent.api.AgentConfiguration type. | AgentConfiguration | |
camel.component.langchain4j-agent.agent-factory | The agent factory to use for creating agents if no Agent is provided. The option is a org.apache.camel.component.langchain4j.agent.api.AgentFactory type. | AgentFactory | |
camel.component.langchain4j-agent.autowired-enabled | 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. | true | Boolean |
camel.component.langchain4j-agent.configuration | The configuration. The option is a org.apache.camel.component.langchain4j.agent.LangChain4jAgentConfiguration type. | LangChain4jAgentConfiguration | |
camel.component.langchain4j-agent.enabled | Whether to enable auto configuration of the langchain4j-agent component. This is enabled by default. | Boolean | |
camel.component.langchain4j-agent.json-schema | 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. | String | |
camel.component.langchain4j-agent.lazy-start-producer | 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. | false | Boolean |
camel.component.langchain4j-agent.mcp-clients | Pre-built MCP (Model Context Protocol) client instances for external tool integration. Reference beans from the registry, e.g., #myMcpClient1,#myMcpClient2 | McpClient> | |
camel.component.langchain4j-agent.mcp-server | 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. | Object> | |
camel.component.langchain4j-agent.output-class | 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. | Object> | |
camel.component.langchain4j-agent.tags | Tags for discovering and calling Camel route tools | String |