Record Class ChatUiRequest

java.lang.Object
java.lang.Record
io.agentscope.harness.agent.gateway.channel.chatui.ChatUiRequest
Record Components:
peerId - optional user / peer identifier; null means "no peer" (single-session mode)
agentId - optional explicit agent override; null for normal binding-driven routing
subagentId - optional exposed subagent id for direct subagent routing; null for normal routing
messages - one or more messages to send

public record ChatUiRequest(String peerId, String agentId, String subagentId, List<io.agentscope.core.message.Msg> messages) extends Record
Request object for ChatUiChannel. Carries the peer identity (optional) and the messages to send to the agent.

The peerId is used by the channel router to build a stable session key:

  • If peerId is null and the channel's DmScope is MAIN, all requests share one session — convenient for single-user or testing scenarios.
  • If peerId is provided, each distinct peer gets its own session (when using PER_PEER or similar scopes).
  • Constructor Details

    • ChatUiRequest

      public ChatUiRequest(String peerId, String agentId, String subagentId, List<io.agentscope.core.message.Msg> messages)
      Creates an instance of a ChatUiRequest record class.
      Parameters:
      peerId - the value for the peerId record component
      agentId - the value for the agentId record component
      subagentId - the value for the subagentId record component
      messages - the value for the messages record component
  • Method Details

    • of

      public static ChatUiRequest of(String text)
      Single user-text message in single-session mode (no peer).
    • withPeer

      public static ChatUiRequest withPeer(String peerId, String text)
      Single user-text message associated with a specific peer id.
    • forAgent

      public static ChatUiRequest forAgent(String peerId, String agentId, String text)
      Single user-text message targeted at a specific agent.
    • toSubagent

      public static ChatUiRequest toSubagent(String subagentId, String text)
      Single user-text message routed directly to an exposed subagent.
    • of

      public static ChatUiRequest of(List<io.agentscope.core.message.Msg> messages)
      Multi-message request without a peer (single-session mode).
    • withPeer

      public static ChatUiRequest withPeer(String peerId, List<io.agentscope.core.message.Msg> messages)
      Multi-message request for a specific peer.
    • 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.
    • peerId

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

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

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

      public List<io.agentscope.core.message.Msg> messages()
      Returns the value of the messages record component.
      Returns:
      the value of the messages record component