Annotation Interface ParallelExecutor


@Retention(RUNTIME) @Target(METHOD) public @interface ParallelExecutor
Used in combination with ParallelAgent or ParallelMapperAgent to specify the executor that will be used to run the sub-agents in parallel. The method annotated with ParallelExecutor must be static on the agent type and return an instance of Executor. It can optionally declare parameters resolved through SupplierParameterResolver.

Example:


    public interface EveningPlannerAgent {

        @ParallelAgent(outputKey = "plans",
                subAgents = { FoodExpert.class, MovieExpert.class })
        List<EveningPlan> plan(@V("mood") String mood);

        @ParallelExecutor
        static Executor executor() {
            return Executors.newFixedThreadPool(2);
        }
    }

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.