Annotation Interface PlannerAgent
Marks a method as a definition of an agent based on a custom planner.
Each sub-agent is defined using the
SubAgent annotation, which specifies the sub-agent's type
and its output variable name.
Example:
public interface PlannerBasedStoryCreator {
@PlannerAgent(
outputKey = "story",
subAgents = {
@SubAgent(type = CreativeWriter.class, outputKey = "story"),
@SubAgent(type = AudienceEditor.class, outputKey = "story"),
@SubAgent(type = StyleEditor.class, outputKey = "story")
})
String write(@V("topic") String topic, @V("style") String style, @V("audience") String audience);
@PlannerSupplier
static Planner planner() {
return new SequentialPlanner();
}
}
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional Elements
-
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:
""
-
outputKey
String outputKeyKey of the output variable that will be used to store the result of the agent's invocation.- Returns:
- name of the output variable.
- Default:
""
-
subAgents
SubAgent[] subAgentsArray of sub-agents that will be invoked in sequence.- Returns:
- array of sub-agents.
-