Annotation Interface DecisionModelSupplier


@Experimental @Retention(RUNTIME) @Target(METHOD) public @interface DecisionModelSupplier
Marks a method as the supplier of the decision model used by a decision agent (see AgenticServices.decisionAgentBuilder(Class)). The method must be static and return a DecisionModel.

When the method has no parameters, it is invoked once at build time to provide a fixed model. When the method has parameters annotated with @V, they are resolved from the current AgenticScope at each invocation, enabling dynamic model selection based on runtime state. Parameters resolved through a SupplierParameterResolver are resolved each time the method is invoked.

An interface declaring this method is recognized as a decision agent by the declarative API, also when its @Agent method returns an object with several @Decide fields and is not itself annotated with @Decide. It must not declare a ChatModelSupplier or a StreamingChatModelSupplier. Declaring this method on any other kind of agent, like an AI agent, a workflow or a non-AI agent, fails at build time.

Example:


    public interface CategoryRouter {

        @Decide("Which kind of expert should handle this request?")
        @Agent(value = "Categorizes a user request", outputKey = "category")
        RequestCategory classify(@V("request") String request);

        @DecisionModelSupplier
        static DecisionModel decisionModel() {
            return routingDecisionModel();
        }
    }

Since:
1.23.0