Class AgentsConfig.BuilderBase<BUILDER extends AgentsConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends AgentsConfig>

java.lang.Object
io.helidon.integrations.langchain4j.AgentsConfig.BuilderBase<BUILDER,PROTOTYPE>
Type Parameters:
BUILDER - type of the builder extending this abstract builder
PROTOTYPE - type of the prototype interface that would be built by Prototype.Builder.buildPrototype()
All Implemented Interfaces:
Prototype.Builder<BUILDER,PROTOTYPE>, ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>, ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
Direct Known Subclasses:
AgentsConfig.Builder
Enclosing interface:
AgentsConfig

public abstract static class AgentsConfig.BuilderBase<BUILDER extends AgentsConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends AgentsConfig> extends Object implements ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
Fluent API builder base for AgentsConfig.
  • Constructor Details

    • BuilderBase

      protected BuilderBase()
      Protected to support extensibility.
  • Method Details

    • from

      public BUILDER from(AgentsConfig prototype)
      Update this builder from an existing prototype instance. This method disables automatic service discovery.
      Parameters:
      prototype - existing prototype to update this builder from
      Returns:
      updated builder instance
    • from

      public BUILDER from(AgentsConfig.BuilderBase<?,?> builder)
      Update this builder from an existing prototype builder instance.
      Parameters:
      builder - existing builder prototype to update this builder from
      Returns:
      updated builder instance
    • config

      @Deprecated public BUILDER config(Config config)
      Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.
      Specified by:
      config in interface ConfigBuilderSupport.ConfiguredBuilder<BUILDER extends AgentsConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends AgentsConfig>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      Returns:
      updated builder instance
    • config

      public BUILDER config(Config config)
      Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.
      Specified by:
      config in interface ConfigBuilderSupport.ConfiguredBuilder<BUILDER extends AgentsConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends AgentsConfig>
      Parameters:
      config - configuration instance used to obtain values to update this builder
      Returns:
      updated builder instance
    • enabled

      public BUILDER enabled(boolean enabled)
      If set to false, agent will not be available even if configured.
      Parameters:
      enabled - whether agent is enabled, defaults to true
      Returns:
      updated builder instance
      See Also:
    • clearName

      public BUILDER clearName()
      Clear existing value of name.
      Returns:
      updated builder instance
      See Also:
    • name

      public BUILDER name(String name)
      Agent identifier used to label the agent in workflows and/or agent registries.

      If configured, this value is applied to the underlying agent builder via agentBuilder.name(...).

      Parameters:
      name - configured agent name, or empty if not configured
      Returns:
      updated builder instance
      See Also:
    • clearDescription

      public BUILDER clearDescription()
      Clear existing value of description.
      Returns:
      updated builder instance
      See Also:
    • description

      public BUILDER description(String description)
      Description of the agent. It should be clear and descriptive to allow a language model to understand the agent's purpose and its intended use.
      Parameters:
      description - description of the agent.
      Returns:
      updated builder instance
      See Also:
    • clearOutputKey

      public BUILDER clearOutputKey()
      Clear existing value of outputKey.
      Returns:
      updated builder instance
      See Also:
    • outputKey

      public BUILDER outputKey(String outputKey)
      Key of the output variable that will be used to store the result of the agent's invocation.
      Parameters:
      outputKey - name of the output variable.
      Returns:
      updated builder instance
      See Also:
    • clearAsync

      public BUILDER clearAsync()
      Clear existing value of async.
      Returns:
      updated builder instance
      See Also:
    • async

      public BUILDER async(boolean async)
      If true, the agent will be invoked in an asynchronous manner, allowing the workflow to continue without waiting for the agent's result.
      Parameters:
      async - true if the agent should be invoked asynchronously, false otherwise.
      Returns:
      updated builder instance
      See Also:
    • clearExecuteToolsConcurrently

      public BUILDER clearExecuteToolsConcurrently()
      Clear existing value of executeToolsConcurrently.
      Returns:
      updated builder instance
      See Also:
    • executeToolsConcurrently

      public BUILDER executeToolsConcurrently(boolean executeToolsConcurrently)
      If true, the agent's tools can be invoked in a concurrent manner.
      Parameters:
      executeToolsConcurrently - true if agent's tools can be invoked concurrently.
      Returns:
      updated builder instance
      See Also:
    • clearChatModel

      public BUILDER clearChatModel()
      Clear existing value of chatModel.
      Returns:
      updated builder instance
      See Also:
    • chatModel

      public BUILDER chatModel(String chatModel)
      Name of the ChatModel service to use for this agent.

      The value is resolved from the ServiceRegistry.

      Parameters:
      chatModel - configured name of the chat model service, or empty if not configured
      Returns:
      updated builder instance
      See Also:
    • clearChatMemory

      public BUILDER clearChatMemory()
      Clear existing value of chatMemory.
      Returns:
      updated builder instance
      See Also:
    • chatMemory

      public BUILDER chatMemory(String chatMemory)
      Name of the ChatMemory service to use for this agent.

      The value is resolved from the ServiceRegistry.

      Parameters:
      chatMemory - configured name of the chat memory service, or empty if not configured
      Returns:
      updated builder instance
      See Also:
    • clearChatMemoryProvider

      public BUILDER clearChatMemoryProvider()
      Clear existing value of chatMemoryProvider.
      Returns:
      updated builder instance
      See Also:
    • chatMemoryProvider

      public BUILDER chatMemoryProvider(String chatMemoryProvider)
      Name of the ChatMemoryProvider service to use for this agent.

      The value is resolved from the ServiceRegistry.

      Parameters:
      chatMemoryProvider - configured name of the chat memory provider service, or empty if not configured
      Returns:
      updated builder instance
      See Also:
    • clearContentRetriever

      public BUILDER clearContentRetriever()
      Clear existing value of contentRetriever.
      Returns:
      updated builder instance
      See Also:
    • contentRetriever

      public BUILDER contentRetriever(String contentRetriever)
      Name of the ContentRetriever service to use for this agent.

      The value is resolved from the ServiceRegistry.

      Parameters:
      contentRetriever - configured name of the content retriever service, or empty if not configured
      Returns:
      updated builder instance
      See Also:
    • clearRetrievalAugmentor

      public BUILDER clearRetrievalAugmentor()
      Clear existing value of retrievalAugmentor.
      Returns:
      updated builder instance
      See Also:
    • retrievalAugmentor

      public BUILDER retrievalAugmentor(String retrievalAugmentor)
      Name of the RetrievalAugmentor service to use for this agent.

      The value is resolved from the ServiceRegistry.

      Parameters:
      retrievalAugmentor - configured name of the retrieval augmentor service, or empty if not configured
      Returns:
      updated builder instance
      See Also:
    • clearToolProvider

      public BUILDER clearToolProvider()
      Clear existing value of toolProvider.
      Returns:
      updated builder instance
      See Also:
    • toolProvider

      public BUILDER toolProvider(String toolProvider)
      Name of the ToolProvider service to use for this agent.

      The value is resolved from the ServiceRegistry.

      Parameters:
      toolProvider - configured name of the tool provider service, or empty if not configured
      Returns:
      updated builder instance
      See Also:
    • clearTools

      public BUILDER clearTools()
      Clear all tools.
      Returns:
      updated builder instance
      See Also:
    • tools

      public BUILDER tools(Set<Class<?>> tools)
      Tool service classes to register with the agent.

      Each class is resolved from the ServiceRegistry, and the resulting service instances are registered using agentBuilder.tools(...).

      Parameters:
      tools - configured set of tool classes, or an empty set if not configured
      Returns:
      updated builder instance
      See Also:
    • addTools

      public BUILDER addTools(Set<Class<?>> tools)
      Tool service classes to register with the agent.

      Each class is resolved from the ServiceRegistry, and the resulting service instances are registered using agentBuilder.tools(...).

      Parameters:
      tools - configured set of tool classes, or an empty set if not configured
      Returns:
      updated builder instance
      See Also:
    • clearMcpClients

      public BUILDER clearMcpClients()
      Clear all mcpClients.
      Returns:
      updated builder instance
      See Also:
    • mcpClients

      public BUILDER mcpClients(Set<String> mcpClients)
      Names of McpClient services to use for MCP-backed tools.

      Each name is resolved from the ServiceRegistry, the clients are then used to build an McpToolProvider which is registered as the agent's tool provider.

      Parameters:
      mcpClients - configured set of MCP client service names, or an empty set if not configured
      Returns:
      updated builder instance
      See Also:
    • addMcpClients

      public BUILDER addMcpClients(Set<String> mcpClients)
      Names of McpClient services to use for MCP-backed tools.

      Each name is resolved from the ServiceRegistry, the clients are then used to build an McpToolProvider which is registered as the agent's tool provider.

      Parameters:
      mcpClients - configured set of MCP client service names, or an empty set if not configured
      Returns:
      updated builder instance
      See Also:
    • clearInputGuardrails

      public BUILDER clearInputGuardrails()
      Clear all inputGuardrails.
      Returns:
      updated builder instance
      See Also:
    • inputGuardrails

      public BUILDER inputGuardrails(Set<Class<? extends dev.langchain4j.guardrail.InputGuardrail>> inputGuardrails)
      Input guardrail classes to apply to the agent.

      Each class is resolved from the ServiceRegistry.

      Parameters:
      inputGuardrails - configured set of input guardrail classes, or an empty set if not configured
      Returns:
      updated builder instance
      See Also:
    • addInputGuardrails

      public BUILDER addInputGuardrails(Set<Class<? extends dev.langchain4j.guardrail.InputGuardrail>> inputGuardrails)
      Input guardrail classes to apply to the agent.

      Each class is resolved from the ServiceRegistry.

      Parameters:
      inputGuardrails - configured set of input guardrail classes, or an empty set if not configured
      Returns:
      updated builder instance
      See Also:
    • addInputGuardrail

      public BUILDER addInputGuardrail(Class<? extends dev.langchain4j.guardrail.InputGuardrail> inputGuardrail)
      Input guardrail classes to apply to the agent.

      Each class is resolved from the ServiceRegistry.

      Parameters:
      inputGuardrail - add single configured set of input guardrail classes, or an empty set if not configured
      Returns:
      updated builder instance
      See Also:
    • clearOutputGuardrails

      public BUILDER clearOutputGuardrails()
      Clear all outputGuardrails.
      Returns:
      updated builder instance
      See Also:
    • outputGuardrails

      public BUILDER outputGuardrails(Set<Class<? extends dev.langchain4j.guardrail.OutputGuardrail>> outputGuardrails)
      Output guardrail classes to apply to the agent.

      Each class is resolved from the ServiceRegistry,

      Parameters:
      outputGuardrails - configured set of output guardrail classes, or an empty set if not configured
      Returns:
      updated builder instance
      See Also:
    • addOutputGuardrails

      public BUILDER addOutputGuardrails(Set<Class<? extends dev.langchain4j.guardrail.OutputGuardrail>> outputGuardrails)
      Output guardrail classes to apply to the agent.

      Each class is resolved from the ServiceRegistry,

      Parameters:
      outputGuardrails - configured set of output guardrail classes, or an empty set if not configured
      Returns:
      updated builder instance
      See Also:
    • addOutputGuardrail

      public BUILDER addOutputGuardrail(Class<? extends dev.langchain4j.guardrail.OutputGuardrail> outputGuardrail)
      Output guardrail classes to apply to the agent.

      Each class is resolved from the ServiceRegistry,

      Parameters:
      outputGuardrail - add single configured set of output guardrail classes, or an empty set if not configured
      Returns:
      updated builder instance
      See Also:
    • enabled

      public boolean enabled()
      If set to false, agent will not be available even if configured.
      Returns:
      whether agent is enabled, defaults to true
    • name

      public Optional<String> name()
      Agent identifier used to label the agent in workflows and/or agent registries.

      If configured, this value is applied to the underlying agent builder via agentBuilder.name(...).

      Returns:
      configured agent name, or empty if not configured
    • description

      public Optional<String> description()
      Description of the agent. It should be clear and descriptive to allow a language model to understand the agent's purpose and its intended use.
      Returns:
      description of the agent.
    • outputKey

      public Optional<String> outputKey()
      Key of the output variable that will be used to store the result of the agent's invocation.
      Returns:
      name of the output variable.
    • async

      public Optional<Boolean> async()
      If true, the agent will be invoked in an asynchronous manner, allowing the workflow to continue without waiting for the agent's result.
      Returns:
      true if the agent should be invoked asynchronously, false otherwise.
    • executeToolsConcurrently

      public Optional<Boolean> executeToolsConcurrently()
      If true, the agent's tools can be invoked in a concurrent manner.
      Returns:
      true if agent's tools can be invoked concurrently.
    • chatModel

      public Optional<String> chatModel()
      Name of the ChatModel service to use for this agent.

      The value is resolved from the ServiceRegistry.

      Returns:
      configured name of the chat model service, or empty if not configured
    • chatMemory

      public Optional<String> chatMemory()
      Name of the ChatMemory service to use for this agent.

      The value is resolved from the ServiceRegistry.

      Returns:
      configured name of the chat memory service, or empty if not configured
    • chatMemoryProvider

      public Optional<String> chatMemoryProvider()
      Name of the ChatMemoryProvider service to use for this agent.

      The value is resolved from the ServiceRegistry.

      Returns:
      configured name of the chat memory provider service, or empty if not configured
    • contentRetriever

      public Optional<String> contentRetriever()
      Name of the ContentRetriever service to use for this agent.

      The value is resolved from the ServiceRegistry.

      Returns:
      configured name of the content retriever service, or empty if not configured
    • retrievalAugmentor

      public Optional<String> retrievalAugmentor()
      Name of the RetrievalAugmentor service to use for this agent.

      The value is resolved from the ServiceRegistry.

      Returns:
      configured name of the retrieval augmentor service, or empty if not configured
    • toolProvider

      public Optional<String> toolProvider()
      Name of the ToolProvider service to use for this agent.

      The value is resolved from the ServiceRegistry.

      Returns:
      configured name of the tool provider service, or empty if not configured
    • tools

      public Set<Class<?>> tools()
      Tool service classes to register with the agent.

      Each class is resolved from the ServiceRegistry, and the resulting service instances are registered using agentBuilder.tools(...).

      Returns:
      configured set of tool classes, or an empty set if not configured
    • mcpClients

      public Set<String> mcpClients()
      Names of McpClient services to use for MCP-backed tools.

      Each name is resolved from the ServiceRegistry, the clients are then used to build an McpToolProvider which is registered as the agent's tool provider.

      Returns:
      configured set of MCP client service names, or an empty set if not configured
    • inputGuardrails

      public Set<Class<? extends dev.langchain4j.guardrail.InputGuardrail>> inputGuardrails()
      Input guardrail classes to apply to the agent.

      Each class is resolved from the ServiceRegistry.

      Returns:
      configured set of input guardrail classes, or an empty set if not configured
    • outputGuardrails

      public Set<Class<? extends dev.langchain4j.guardrail.OutputGuardrail>> outputGuardrails()
      Output guardrail classes to apply to the agent.

      Each class is resolved from the ServiceRegistry,

      Returns:
      configured set of output guardrail classes, or an empty set if not configured
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • preBuildPrototype

      protected void preBuildPrototype()
      Handles providers and decorators.
    • validatePrototype

      protected void validatePrototype()
      Validates required properties.
    • config

      protected Optional<Config> config()
      Configuration used to configure this instance.
      Returns:
      config instance