Record Class Desire

java.lang.Object
java.lang.Record
dev.langchain4j.agentic.patterns.bdi.Desire
Record Components:
name - human-readable label, used in log messages and error diagnostics
priority - higher value = more important; strictly higher priority triggers preemption
achievable - predicate on AgenticScope — can this desire be pursued now?
satisfied - predicate on AgenticScope — has this desire been achieved?
agentTypes - ordered agent classes forming the intention; resolved to instances at init time

public record Desire(String name, int priority, Predicate<AgenticScope> achievable, Predicate<AgenticScope> satisfied, List<Class<?>> agentTypes) extends Record
A prioritized goal for the BDIPlanner. Each desire declares when it is achievable, when it is satisfied, and the ordered sequence of agent types that form its intention. Higher priority values take precedence; among equal priorities, declaration order wins (stable ordering).
  • Constructor Details

  • Method Details

    • of

      public static Desire of(String name, int priority, Predicate<AgenticScope> achievable, Predicate<AgenticScope> satisfied, Class<?>... agentTypes)
    • of

      public static Desire of(String name, int priority, String achievableStateKey, String satisfiedStateKey, Class<?>... agentTypes)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • priority

      public int priority()
      Returns the value of the priority record component.
      Returns:
      the value of the priority record component
    • achievable

      public Predicate<AgenticScope> achievable()
      Returns the value of the achievable record component.
      Returns:
      the value of the achievable record component
    • satisfied

      public Predicate<AgenticScope> satisfied()
      Returns the value of the satisfied record component.
      Returns:
      the value of the satisfied record component
    • agentTypes

      public List<Class<?>> agentTypes()
      Returns the value of the agentTypes record component.
      Returns:
      the value of the agentTypes record component