Annotation Interface DecisionModelSupplier
AgenticServices.decisionAgentBuilder(Class)). The method must be static on the agent type and
return a DecisionModel.
When the method has no parameters, or only parameters provided by a SupplierParameterResolver, 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. Its parameters provided by a SupplierParameterResolver are
then resolved each time the method is invoked too.
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
Like every helper method, it can be an instance method of a helper object of the agent instead of a static method of the agent type: see the "Helper objects" section of the agentic tutorial and
AgenticServices.AgentConfigurator.