Interface SupplierParameterResolver


public interface SupplierParameterResolver
SPI for resolving parameters of the static methods of declarative agents from external sources such as a dependency injection container.

Applies to the methods annotated with any supplier annotation: ChatModelSupplier, StreamingChatModelSupplier, DecisionModelSupplier, DecisionThresholdSupplier, ContentRetrieverSupplier, RetrievalAugmentorSupplier, ChatMemorySupplier, ChatMemoryProviderSupplier, ToolProviderSupplier, ToolsSupplier, ToolSearchStrategySupplier, AgentListenerSupplier, SystemMessageProviderSupplier, UserMessageProviderSupplier, McpClientSupplier, PlannerSupplier, A2AServerUrlSupplier and ParallelExecutor; to the methods annotated with ExitCondition, ActivationCondition, Output, BeforeCall, ErrorHandler, SupervisorRequest and A2AClientCustomizer; to the static Agent methods of non-AI agents and to the HumanInTheLoop methods.

The methods invoked without any value from the framework, like the ToolsSupplier, PlannerSupplier or ParallelExecutor ones, can only declare resolved parameters: when one of their parameters is not supported by any resolver, the creation of the agent fails with an AgenticSystemConfigurationException.

A parameter supported by a resolver is never read from the AgenticScope and is not an argument of the agent: it is not reported to listeners and planners. For this reason a resolver should only support the parameters explicitly marked for it, for example with a dedicated annotation or qualifier. When several resolvers support the same parameter, the first registered one is used.

Implementations are registered via DeclarativeUtil.addSupplierParameterResolver(SupplierParameterResolver), and must be registered before the agents using them are created.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Called each time the method declaring the parameter is invoked, to obtain the actual value: once, when the agent is created, for the suppliers of fixed components like tools or chat memory, and at each invocation for the methods depending on the agent invocation, like conditions or non-AI agents.
    boolean
    Called at agent creation time to pre-determine which parameters this resolver handles.
  • Method Details

    • supports

      boolean supports(SupplierParameterResolver.Context context)
      Called at agent creation time to pre-determine which parameters this resolver handles. It can be called more than once for the same parameter, so it must not have side effects. SupplierParameterResolver.Context.supplierMethod() is the method declaring the parameter, whatever its annotation.
    • resolve

      Called each time the method declaring the parameter is invoked, to obtain the actual value: once, when the agent is created, for the suppliers of fixed components like tools or chat memory, and at each invocation for the methods depending on the agent invocation, like conditions or non-AI agents. In the latter case it can be called on the thread executing the agent.