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(outputKey = "plans", subAgents = {
@SubAgent(type = FoodExpert.class, outputKey = "meals"),
@SubAgent(type = MovieExpert.class, outputKey = "movies")
})
List<EveningPlan> plan(@V("mood") String mood);
@ParallelExecutor
static Executor executor() {
return Executors.newFixedThreadPool(2);
}
}