Record Class SubagentRecord
java.lang.Object
java.lang.Record
io.agentscope.harness.agent.gateway.SubagentRecord
- Record Components:
subagentId- the user-visible handle for direct addressingagentId- 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, ornullwhen unknownparentSessionId- the parent session that exposed this subagent, ornullcreatedAt- when the subagent was exposedexpiresAt- optional expiry instant;nullmeans 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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionagentId()Returns the value of theagentIdrecord component.Returns the value of thecreatedAtrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theexpiresAtrecord component.static SubagentRecordReconstructs a record from a persisted map, tolerating missing optional fields.final inthashCode()Returns a hash code value for this object.booleanWhether this record has a TTL that has already elapsed relative tonow.Returns the value of theparentSessionIdrecord component.Returns the value of thesessionIdrecord component.Returns the value of thesubagentIdrecord component.toMap()Serializes this record to a flat string/number map forBaseStorepersistence.final StringtoString()Returns a string representation of this record class.userId()Returns the value of theuserIdrecord component.
-
Constructor Details
-
SubagentRecord
public SubagentRecord(String subagentId, String agentId, String sessionId, String userId, String parentSessionId, Instant createdAt, Instant expiresAt) Creates an instance of aSubagentRecordrecord class.- Parameters:
subagentId- the value for thesubagentIdrecord componentagentId- the value for theagentIdrecord componentsessionId- the value for thesessionIdrecord componentuserId- the value for theuserIdrecord componentparentSessionId- the value for theparentSessionIdrecord componentcreatedAt- the value for thecreatedAtrecord componentexpiresAt- the value for theexpiresAtrecord component
-
-
Method Details
-
isExpired
Whether this record has a TTL that has already elapsed relative tonow. -
toMap
Serializes this record to a flat string/number map forBaseStorepersistence. -
fromMap
Reconstructs a record from a persisted map, tolerating missing optional fields. -
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
subagentId
Returns the value of thesubagentIdrecord component.- Returns:
- the value of the
subagentIdrecord component
-
agentId
Returns the value of theagentIdrecord component.- Returns:
- the value of the
agentIdrecord component
-
sessionId
Returns the value of thesessionIdrecord component.- Returns:
- the value of the
sessionIdrecord component
-
userId
Returns the value of theuserIdrecord component.- Returns:
- the value of the
userIdrecord component
-
parentSessionId
Returns the value of theparentSessionIdrecord component.- Returns:
- the value of the
parentSessionIdrecord component
-
createdAt
Returns the value of thecreatedAtrecord component.- Returns:
- the value of the
createdAtrecord component
-
expiresAt
Returns the value of theexpiresAtrecord component.- Returns:
- the value of the
expiresAtrecord component
-