Class ResolvedParameters
java.lang.Object
dev.langchain4j.agentic.internal.ResolvedParameters
The parameters of a helper method of an agent, a static method declared on the agent type or an instance method of
one of its helper objects, split once, when the agent is created, between the parameters provided by a registered
SupplierParameterResolver and the parameters provided by the agentic framework, like the
AgenticScope, its state, the memory id or a value passed by the caller.
Only the parameters provided by the framework are agent arguments: the resolved ones are never read from the
AgenticScope, nor reported to listeners and planners.
-
Method Summary
Modifier and TypeMethodDescriptionObject[]Builds the positional arguments of the method, resolving its resolved parameters, unless already resolved byresolvedNow(), and taking the parameters provided by the framework from the given values, in their order.Checks that all the parameters are provided by a resolver, as required for the methods, like the suppliers of tools or of the planner, that are invoked without any value from the framework.checkFrameworkParameters(Class<?>... expected) Checks that the parameters provided by the framework are exactly the expected ones, in this order.frameworkParameter(int position) intinvocationArguments(AgenticScope agenticScope, Map<String, Object> additionalArgs, boolean writeConvertedValues) Builds the invocation arguments of the method: the parameters provided by the framework are read from theAgenticScope, or taken from the additional arguments, and they are the only named arguments.<T> TInvokes the method on its target, with the parameters provided by the framework taken from the given values.method()static ResolvedParametersof(Class<?> agentType, HelperMethod helper) Splits the parameters of the given helper method using theSupplierParameterResolvers registered inDeclarativeUtil.static ResolvedParametersSplits the parameters of the given method using theSupplierParameterResolvers registered inDeclarativeUtil.Returns a copy of these parameters whose resolved parameters are resolved now, once, instead of at each invocation of the method.
-
Method Details
-
of
Splits the parameters of the given method using theSupplierParameterResolvers registered inDeclarativeUtil. The method is invoked without a target: it is a static method, or an instance method whose target is given at each invocation, like theAgentmethod of a non-AI agent.- Parameters:
agentType- the agent class or interface declaring the method, or inheriting itmethod- the method to invoke
-
of
Splits the parameters of the given helper method using theSupplierParameterResolvers registered inDeclarativeUtil.- Parameters:
agentType- the agent class or interface the method is a helper ofhelper- the method to invoke, with its target
-
method
-
frameworkArguments
- Returns:
- the parameters provided by the framework, as agent arguments, in the order they are declared
-
frameworkParameterCount
public int frameworkParameterCount()- Returns:
- the number of parameters provided by the framework
-
frameworkParameter
- Returns:
- the parameter at the given position among the ones provided by the framework
-
checkFrameworkParameters
Checks that the parameters provided by the framework are exactly the expected ones, in this order.- Throws:
IllegalArgumentException- if they are not
-
checkAllResolved
Checks that all the parameters are provided by a resolver, as required for the methods, like the suppliers of tools or of the planner, that are invoked without any value from the framework.- Throws:
AgenticSystemConfigurationException- if a parameter is not supported by any resolver
-
resolvedNow
Returns a copy of these parameters whose resolved parameters are resolved now, once, instead of at each invocation of the method. For the methods invoked later than the creation of the agent, like the one annotated with@A2AClientCustomizer, which runs when the A2A client is created on the first invocation of the agent: a value resolved per request, like a token, is then the one of the thread creating the agent, as for the other supplier methods, and not the one of the first caller. -
arguments
Builds the positional arguments of the method, resolving its resolved parameters, unless already resolved byresolvedNow(), and taking the parameters provided by the framework from the given values, in their order. The parameters provided by the framework without a corresponding value arenull. -
invocationArguments
public AgentInvocationArguments invocationArguments(AgenticScope agenticScope, Map<String, Object> additionalArgs, boolean writeConvertedValues) Builds the invocation arguments of the method: the parameters provided by the framework are read from theAgenticScope, or taken from the additional arguments, and they are the only named arguments. Without anAgenticScopethe parameters provided by the framework arenull. -
invoke
Invokes the method on its target, with the parameters provided by the framework taken from the given values. Failures are reported as byHelperMethod.invoke(Object...).
-