Annotation Interface ActivationCondition


@Retention(RUNTIME) @Target(METHOD) public @interface ActivationCondition
Marks a method as an activation predicate for one or more sub-agents of a conditional agent. The method must be static and return a boolean indicating whether the sub-agent(s) should be activated.

Example:


    public interface ExpertsAgent {

        @ConditionalAgent(outputKey = "response", subAgents = {
                @SubAgent(type = MedicalExpert.class, outputKey = "response"),
                @SubAgent(type = TechnicalExpert.class, outputKey = "response"),
                @SubAgent(type = LegalExpert.class, outputKey = "response")
        })
        String askExpert(@V("request") String request);

        @ActivationCondition(value = MedicalExpert.class, description = "category is medical")
        static boolean activateMedical(@V("category") RequestCategory category) {
            return category == RequestCategory.MEDICAL;
        }

        @ActivationCondition(TechnicalExpert.class)
        static boolean activateTechnical(@V("category") RequestCategory category) {
            return category == RequestCategory.TECHNICAL;
        }

        @ActivationCondition(LegalExpert.class)
        static boolean activateLegal(AgenticScope agenticScope) {
            return agenticScope.readState("category", RequestCategory.UNKNOWN) == RequestCategory.LEGAL;
        }
    }

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Class<?>[]
    One or more sub-agent classes that this activation condition applies to.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Description of the activation condition.
  • Element Details

    • value

      Class<?>[] value
      One or more sub-agent classes that this activation condition applies to.
      Returns:
      array of sub-agent classes.
    • description

      String description
      Description of the activation condition. It should be clear and descriptive to allow understanding the purpose of the condition.
      Returns:
      description of the activation condition.
      Default:
      "<unknown>"