Annotation Interface ParallelExecutor
Used in combination with
ParallelAgent
to specify the executor that will be used to run the sub-agents in parallel.
The method annotated with ParallelExecutor
must be static and return an instance of Executor
.
Example:
public interface EveningPlannerAgent {
@ParallelAgent(outputName = "plans", subAgents = {
@SubAgent(type = FoodExpert.class, outputName = "meals"),
@SubAgent(type = MovieExpert.class, outputName = "movies")
})
List<EveningPlan> plan(@V("mood") String mood);
@ParallelExecutor
static Executor executor() {
return Executors.newFixedThreadPool(2);
}
}