Annotation Interface SupervisorAgent
Marks a method as a supervisor agent that can autonomously coordinate and invoke multiple sub-agents.
Example:
public interface SupervisorBanker {
@SupervisorAgent(responseStrategy = SupervisorResponseStrategy.SUMMARY, subAgents = {
@SubAgent(type = WithdrawAgent.class),
@SubAgent(type = CreditAgent.class)
})
String invoke(@V("request") String request);
@ChatModelSupplier
static ChatModel chatModel() {
return plannerModel();
}
}
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionStrategy for providing context to the supervisor agent.Description of the agent.int
Maximum number of sub-agent invocations allowed during a single supervisor agent execution.Name of the agent.Name of the output variable that will hold the result of the agent invocation.Strategy to decide which response the supervisor agent should return.
-
Element Details
-
name
String nameName of the agent. If not provided, method name will be used.- Returns:
- name of the agent.
- Default:
""
-
description
String descriptionDescription of the agent. It should be clear and descriptive to allow language model to understand the agent's purpose and its intended use.- Returns:
- description of the agent.
- Default:
""
-
outputName
String outputNameName of the output variable that will hold the result of the agent invocation.- Returns:
- name of the output variable.
- Default:
""
-
subAgents
SubAgent[] subAgentsArray of sub-agents that can be invoked by the supervisor agent.- Returns:
- array of sub-agents.
-
maxAgentsInvocations
int maxAgentsInvocationsMaximum number of sub-agent invocations allowed during a single supervisor agent execution. This limit helps prevent infinite loops and excessive resource consumption.- Returns:
- maximum number of sub-agent invocations.
- Default:
10
-
contextStrategy
SupervisorContextStrategy contextStrategyStrategy for providing context to the supervisor agent.- Default:
CHAT_MEMORY
-
responseStrategy
SupervisorResponseStrategy responseStrategyStrategy to decide which response the supervisor agent should return.- Default:
LAST
-