Class ResolvedParameters

java.lang.Object
dev.langchain4j.agentic.internal.ResolvedParameters

public final class ResolvedParameters extends Object
The parameters of a static method declared on an agent type, 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 Details

    • of

      public static ResolvedParameters of(Class<?> agentType, Method method)
      Splits the parameters of the given method using the SupplierParameterResolvers registered in DeclarativeUtil.
      Parameters:
      agentType - the agent class or interface declaring the method, or inheriting it
      method - the static method to invoke
    • method

      public Method method()
    • frameworkArguments

      public List<AgentArgument> 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

      public Parameter frameworkParameter(int position)
      Returns:
      the parameter at the given position among the ones provided by the framework
    • checkFrameworkParameters

      public ResolvedParameters checkFrameworkParameters(Class<?>... expected)
      Checks that the parameters provided by the framework are exactly the expected ones, in this order.
      Throws:
      IllegalArgumentException - if they are not
    • checkAllResolved

      public ResolvedParameters 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
    • arguments

      public Object[] arguments(Object... frameworkValues)
      Builds the positional arguments of the method, resolving its resolved parameters 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 are null.
    • 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 the AgenticScope, or taken from the additional arguments, and they are the only named arguments. Without an AgenticScope the parameters provided by the framework are null.
    • invoke

      public <T> T invoke(Object... frameworkValues)
      Invokes the static method, with the parameters provided by the framework taken from the given values. Failures are reported as by DeclarativeUtil.invokeStatic(Method, Object...).