AS AgentScopeAPI 手册 / API Reference

Peer

public record Peer(PeerKind kind, String id)
源码Source io/agentscope/harness/agent/gateway/channel/Peer.java:27–58

承载对端数据的记录类型。位于 io.agentscope.harness.agent.gateway.channel 包。核心成员包括 kind、id、key、direct、channel、group。

Identifies the conversation peer: who or what is being messaged (a user DM, a channel, a group, or a thread). Used by ChannelRouter for binding evaluation and session key construction.

记录组件摘要Record Component Summary

组件Component类型Type说明Description
kindPeerKind
执行种类相关操作。
the peer classification
idString
执行标识相关操作。
provider-assigned peer identifier (user id, channel id, thread id, etc.)

构造器摘要Constructor Summary

构造器Constructor说明Description
public Peer(PeerKind kind, String id)
初始化 `Peer` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public String key()
返回键。
Returns the composite key `"<kind>:<id>"` used in binding matching.
public static Peer direct(String id)
static
设置该参数。
Creates a direct / DM peer.
public static Peer channel(String id)
static
创建渠道对端。
Creates a channel peer.
public static Peer group(String id)
static
创建组对端。
Creates a group peer.
public static Peer thread(String id)
static
创建会话线程对端。
Creates a thread peer.

记录组件详情Record Component Detail

kind

PeerKind kind

执行种类相关操作。

the peer classification

源码Source io/agentscope/harness/agent/gateway/channel/Peer.java:27–58

id

String id

执行标识相关操作。

provider-assigned peer identifier (user id, channel id, thread id, etc.)

源码Source io/agentscope/harness/agent/gateway/channel/Peer.java:27–58

构造器详情Constructor Detail

Peer

public Peer(PeerKind kind, String id)

初始化 Peer 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
kindPeerKind种类(类型 `PeerKind`)。The kind.
idString标识(类型 `String`)。The id.
源码Source io/agentscope/harness/agent/gateway/channel/Peer.java:29–32

方法详情Method Detail

key

public String key()

返回键。

Returns the composite key " : " used in binding matching.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/gateway/channel/Peer.java:35–37

direct

public static Peer direct(String id)
static

设置该参数。

Creates a direct / DM peer.

参数Parameters
名称Name类型Type说明Description
idString标识(类型 `String`)。The id.
返回Returns Peer
返回对端。Returns peer.
源码Source io/agentscope/harness/agent/gateway/channel/Peer.java:40–42

channel

public static Peer channel(String id)
static

创建渠道对端。

Creates a channel peer.

参数Parameters
名称Name类型Type说明Description
idString标识(类型 `String`)。The id.
返回Returns Peer
返回对端。Returns peer.
源码Source io/agentscope/harness/agent/gateway/channel/Peer.java:45–47

group

public static Peer group(String id)
static

创建组对端。

Creates a group peer.

参数Parameters
名称Name类型Type说明Description
idString标识(类型 `String`)。The id.
返回Returns Peer
返回对端。Returns peer.
源码Source io/agentscope/harness/agent/gateway/channel/Peer.java:50–52

thread

public static Peer thread(String id)
static

创建会话线程对端。

Creates a thread peer.

参数Parameters
名称Name类型Type说明Description
idString标识(类型 `String`)。The id.
返回Returns Peer
返回对端。Returns peer.
源码Source io/agentscope/harness/agent/gateway/channel/Peer.java:55–57
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.