Record Class ChannelConfig

java.lang.Object
java.lang.Record
io.agentscope.harness.agent.gateway.channel.ChannelConfig
Record Components:
channelId - the logical channel identifier this config applies to (must match Channel.channelId())
defaultAgentId - fallback agent id when no binding matches; if null the global default agent (registered via Gateway.bindMainAgent(io.agentscope.harness.agent.HarnessAgent)) is used
dmScope - controls how DM (PeerKind.DIRECT) sessions are keyed; defaults to DmScope.MAIN
bindings - ordered list of binding rules; evaluated in list order within each priority tier

public record ChannelConfig(String channelId, String defaultAgentId, DmScope dmScope, List<ChannelBinding> bindings) extends Record
Per-channel routing configuration: default agent fallback, DM session scope, and ordered binding rules evaluated by ChannelRouter.

Used by Channel implementations to parameterize routing without hard-coding agent ids or session shapes in adapter code.

  • Constructor Details

    • ChannelConfig

      public ChannelConfig(String channelId, String defaultAgentId, DmScope dmScope, List<ChannelBinding> bindings)
      Creates an instance of a ChannelConfig record class.
      Parameters:
      channelId - the value for the channelId record component
      defaultAgentId - the value for the defaultAgentId record component
      dmScope - the value for the dmScope record component
      bindings - the value for the bindings record component
  • Method Details

    • of

      public static ChannelConfig of(String channelId)
      Minimal config: channel id only, using global agent default and DmScope.MAIN.
    • of

      public static ChannelConfig of(String channelId, String defaultAgentId)
      Config with explicit default agent (no binding rules).
    • builder

      public static ChannelConfig.Builder builder(String channelId)
      Returns a builder for constructing channel configs fluently.
    • 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.
    • channelId

      public String channelId()
      Returns the value of the channelId record component.
      Returns:
      the value of the channelId record component
    • defaultAgentId

      public String defaultAgentId()
      Returns the value of the defaultAgentId record component.
      Returns:
      the value of the defaultAgentId record component
    • dmScope

      public DmScope dmScope()
      Returns the value of the dmScope record component.
      Returns:
      the value of the dmScope record component
    • bindings

      public List<ChannelBinding> bindings()
      Returns the value of the bindings record component.
      Returns:
      the value of the bindings record component