Record Class AgentHierarchyEvent

java.lang.Object
java.lang.Record
com.tnsai.events.AgentHierarchyEvent
Record Components:
eventId - unique identifier for this event
timestamp - when the event occurred
agentNodes - a list of maps, each representing an agent in the hierarchy with its ID, name, role, status, and children IDs.
All Implemented Interfaces:
TnsAIEvent

public record AgentHierarchyEvent(String eventId, Instant timestamp, List<Map<String,Object>> agentNodes) extends Record implements TnsAIEvent
Event representing a snapshot of the agent's hierarchy and state, intended for multi-agent visualization in the frontend.

To create an event from an Agent hierarchy, use AgentHierarchyMapper.toNodeList(com.tnsai.agents.Agent) to build the node list first.

  • Constructor Details

    • AgentHierarchyEvent

      public AgentHierarchyEvent(String eventId, Instant timestamp, List<Map<String,Object>> agentNodes)
      Creates an instance of a AgentHierarchyEvent record class.
      Parameters:
      eventId - the value for the eventId record component
      timestamp - the value for the timestamp record component
      agentNodes - the value for the agentNodes record component
  • Method Details

    • of

      public static AgentHierarchyEvent of(List<Map<String,Object>> agentNodes)
      Creates a new AgentHierarchyEvent from a pre-built list of agent nodes.
      Parameters:
      agentNodes - flat list of agent node maps
      Returns:
      a new event instance
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • eventId

      public String eventId()
      Returns the value of the eventId record component.
      Specified by:
      eventId in interface TnsAIEvent
      Returns:
      the value of the eventId record component
    • timestamp

      public Instant timestamp()
      Returns the value of the timestamp record component.
      Specified by:
      timestamp in interface TnsAIEvent
      Returns:
      the value of the timestamp record component
    • agentNodes

      public List<Map<String,Object>> agentNodes()
      Returns the value of the agentNodes record component.
      Returns:
      the value of the agentNodes record component