Interface AgentsConfig
- All Superinterfaces:
Prototype.Api
- All Known Implementing Classes:
AgentsConfig.BuilderBase.AgentsConfigImpl
The configuration primarily consists of:
- Basic agent metadata (name, description, output key)
- Execution settings (async invocation and concurrent tool execution)
- References to services resolved from the
ServiceRegistry(model, memory, retriever, tools, etc.) - Guardrail class lists resolved from the
ServiceRegistry
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classFluent API builder forAgentsConfig.static classAgentsConfig.BuilderBase<BUILDER extends AgentsConfig.BuilderBase<BUILDER,PROTOTYPE>, PROTOTYPE extends AgentsConfig> Fluent API builder base forAgentsConfig. -
Method Summary
Modifier and TypeMethodDescriptionasync()If true, the agent will be invoked in an asynchronous manner, allowing the workflow to continue without waiting for the agent's result.static AgentsConfig.Builderbuilder()Create a new fluent API builder to customize configuration.static AgentsConfig.Builderbuilder(AgentsConfig instance) Create a new fluent API builder from an existing instance.Name of theChatMemoryservice to use for this agent.Name of theChatMemoryProviderservice to use for this agent.Name of theChatModelservice to use for this agent.default voidconfigure(dev.langchain4j.agentic.AgenticServices.DeclarativeAgentCreationContext<?> ctx, ServiceRegistry serviceRegistry) Configures LangChain4jAgentBuilderfromAgentsConfig.Name of theContentRetrieverservice to use for this agent.static AgentsConfigcreate()Create a new instance with default values.static AgentsConfigDeprecated.static AgentsConfigCreate a new instance from configuration.Description of the agent.booleanenabled()If set tofalse, agent will not be available even if configured.If true, the agent's tools can be invoked in a concurrent manner.Input guardrail classes to apply to the agent.Names ofMcpClientservices to use for MCP-backed tools.name()Agent identifier used to label the agent in workflows and/or agent registries.Output guardrail classes to apply to the agent.Key of the output variable that will be used to store the result of the agent's invocation.Name of theRetrievalAugmentorservice to use for this agent.Name of theToolProviderservice to use for this agent.tools()Tool service classes to register with the agent.
-
Method Details
-
builder
Create a new fluent API builder to customize configuration.- Returns:
- a new builder
-
builder
Create a new fluent API builder from an existing instance.- Parameters:
instance- an existing instance used as a base for the builder- Returns:
- a builder based on an instance
-
create
Create a new instance from configuration.- Parameters:
config- used to configure the new instance- Returns:
- a new instance configured from configuration
-
create
Deprecated.Create a new instance from configuration.- Parameters:
config- used to configure the new instance- Returns:
- a new instance configured from configuration
-
create
Create a new instance with default values.- Returns:
- a new instance
-
configure
default void configure(dev.langchain4j.agentic.AgenticServices.DeclarativeAgentCreationContext<?> ctx, ServiceRegistry serviceRegistry) Configures LangChain4jAgentBuilderfromAgentsConfig.This method resolves any configured service references (such as
ChatModel,ChatMemory,ChatMemoryProvider,ContentRetriever,RetrievalAugmentor,ToolProvider, andMcpClient) from the providedServiceRegistryand applies them to the builder obtained from the supplied context.- Parameters:
ctx- context providing the agent builder to configureserviceRegistry- registry used to resolve configured service references- Throws:
NullPointerException- if any configured tool class or MCP client cannot be resolved from the registryIllegalStateException- if any configured tool class or MCP client cannot be resolved from the registry
-
enabled
boolean enabled()If set tofalse, agent will not be available even if configured.- Returns:
- whether agent is enabled, defaults to
true
-
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
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
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
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
If true, the agent's tools can be invoked in a concurrent manner.- Returns:
- true if agent's tools can be invoked concurrently.
-
chatModel
Name of theChatModelservice 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
Name of theChatMemoryservice 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
Name of theChatMemoryProviderservice 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
Name of theContentRetrieverservice 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
Name of theRetrievalAugmentorservice 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
Name of theToolProviderservice 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
Tool service classes to register with the agent.Each class is resolved from the
ServiceRegistry, and the resulting service instances are registered usingagentBuilder.tools(...).- Returns:
- configured set of tool classes, or an empty set if not configured
-
mcpClients
Names ofMcpClientservices to use for MCP-backed tools.Each name is resolved from the
ServiceRegistry, the clients are then used to build anMcpToolProviderwhich is registered as the agent's tool provider.- Returns:
- configured set of MCP client service names, or an empty set if not configured
-
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
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
-
create(io.helidon.config.Config)