Record Class SubagentRecord

java.lang.Object
java.lang.Record
io.agentscope.harness.agent.gateway.SubagentRecord
Record Components:
subagentId - the user-visible handle for direct addressing
agentId - the subagent type identifier (used to re-materialize the agent)
sessionId - the subagent's own session id (used to load its conversational state)
userId - the originating user id, or null when unknown
parentSessionId - the parent session that exposed this subagent, or null
createdAt - when the subagent was exposed
expiresAt - optional expiry instant; null means no TTL

public record SubagentRecord(String subagentId, String agentId, String sessionId, String userId, String parentSessionId, Instant createdAt, Instant expiresAt) extends Record
Durable, recovery-oriented descriptor of an exposed subagent. Unlike the in-memory ExposedSession (which holds a live Agent reference), a SubagentRecord stores only the recipe needed to re-materialize and route to the subagent on any node: its type (agentId), its own conversational session (sessionId), and lifecycle metadata.

The agentId feeds the agent factory to rebuild the instance; the sessionId is passed at invocation time so the rebuilt agent loads the correct conversation history from a (distributed) AgentStateStore.

  • Constructor Details

    • SubagentRecord

      public SubagentRecord(String subagentId, String agentId, String sessionId, String userId, String parentSessionId, Instant createdAt, Instant expiresAt)
      Creates an instance of a SubagentRecord record class.
      Parameters:
      subagentId - the value for the subagentId record component
      agentId - the value for the agentId record component
      sessionId - the value for the sessionId record component
      userId - the value for the userId record component
      parentSessionId - the value for the parentSessionId record component
      createdAt - the value for the createdAt record component
      expiresAt - the value for the expiresAt record component
  • Method Details

    • isExpired

      public boolean isExpired(Instant now)
      Whether this record has a TTL that has already elapsed relative to now.
    • toMap

      public Map<String,Object> toMap()
      Serializes this record to a flat string/number map for BaseStore persistence.
    • fromMap

      public static SubagentRecord fromMap(Map<String,Object> m)
      Reconstructs a record from a persisted map, tolerating missing optional fields.
    • 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.
    • subagentId

      public String subagentId()
      Returns the value of the subagentId record component.
      Returns:
      the value of the subagentId record component
    • agentId

      public String agentId()
      Returns the value of the agentId record component.
      Returns:
      the value of the agentId record component
    • sessionId

      public String sessionId()
      Returns the value of the sessionId record component.
      Returns:
      the value of the sessionId record component
    • userId

      public String userId()
      Returns the value of the userId record component.
      Returns:
      the value of the userId record component
    • parentSessionId

      public String parentSessionId()
      Returns the value of the parentSessionId record component.
      Returns:
      the value of the parentSessionId record component
    • createdAt

      public Instant createdAt()
      Returns the value of the createdAt record component.
      Returns:
      the value of the createdAt record component
    • expiresAt

      public Instant expiresAt()
      Returns the value of the expiresAt record component.
      Returns:
      the value of the expiresAt record component