AS AgentScopeAPI 手册 / API Reference

ManagedSessionChannelBridge

@Component public class ManagedSessionChannelBridge
源码Source io/agentscope/builder/web/managed/ManagedSessionChannelBridge.java:52–233

托管会话渠道 Bridge,承载智能体的部署、调度与服务化运行。位于 io.agentscope.builder.web.managed 包。核心成员包括 dispatchAndAwaitReply、ManagedSessionChannelBridge。

Bridges inbound IM channel turns (DingTalk, Feishu, WeCom, GitHub, GitLab, ...) into the managed-session model across plane boundaries:

  • POST /api/internal/sessions/find-or-create on the control plane resolves (or creates and version-pins) the session for the channel conversation;

  • POST /api/sessions/{id}/events on the data plane posts the user message, which schedules the harness turn asynchronously;

  • GET /api/sessions/{id}/events?after=seq on the data plane is polled until the turn reaches a terminal status, and the last agent.message text is returned as the channel reply.

All calls authenticate with the shared internal token; the acting owner is carried in X-Builder-Internal-User so the receiving plane attributes the operation to the channel tenant. The bridge performs blocking polls on boundedElastic — one in-flight turn per channel conversation, so contention stays bounded by inbound message rate.

构造器摘要Constructor Summary

构造器Constructor说明Description
public ManagedSessionChannelBridge(WebClient controlPlane, WebClient dataPlane, long replyTimeoutMs, long pollIntervalMs)
初始化 `ManagedSessionChannelBridge` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public Mono<String> dispatchAndAwaitReply(String ownerId, String agentId, String externalKey, String text)
执行 `dispatchAndAwaitReply` 方法。
Posts `text` as a user message on the found-or-created managed session and waits for the turn to finish, returning the assistant reply text.
public Mono<String> dispatchAndAwaitReply(String ownerId, String agentId, String text)
deprecated
执行 `dispatchAndAwaitReply` 方法。
Performs the dispatch and await reply operation.

构造器详情Constructor Detail

ManagedSessionChannelBridge

public ManagedSessionChannelBridge(WebClient controlPlane, WebClient dataPlane, long replyTimeoutMs, long pollIntervalMs)

初始化 ManagedSessionChannelBridge 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
controlPlaneWebClient控制面(类型 `WebClient`)。The control plane.
dataPlaneWebClient数据面(类型 `WebClient`)。The data plane.
replyTimeoutMslong回复超时 Ms(类型 `long`)。The reply timeout ms.
pollIntervalMslongpoll 间隔 Ms(类型 `long`)。The poll interval ms.
源码Source io/agentscope/builder/web/managed/ManagedSessionChannelBridge.java:65–74

方法详情Method Detail

dispatchAndAwaitReply

public Mono<String> dispatchAndAwaitReply(String ownerId, String agentId, String externalKey, String text)

执行 dispatchAndAwaitReply 方法。

Posts text as a user message on the found-or-created managed session and waits for the turn to finish, returning the assistant reply text.

参数Parameters
名称Name类型Type说明Description
ownerIdString所有者标识(类型 `String`)。Builder tenant that owns the channel / agent (not the IM peer)
agentIdString智能体标识(类型 `String`)。target managed agent id
externalKeyString外部键(类型 `String`)。stable conversation key (`ChannelExternalKeys`)
textString文本(类型 `String`)。user message text
返回Returns Mono<String>
返回Mono。Returns mono.
源码Source io/agentscope/builder/web/managed/ManagedSessionChannelBridge.java:85–89

dispatchAndAwaitReply

public Mono<String> dispatchAndAwaitReply(String ownerId, String agentId, String text)
deprecated

执行 dispatchAndAwaitReply 方法。

Performs the dispatch and await reply operation.

已弃用。Deprecated. 已弃用,请改用受支持的替代 API。use `#dispatchAndAwaitReply(String, String, String, String)`
参数Parameters
名称Name类型Type说明Description
ownerIdString所有者标识(类型 `String`)。The owner id.
agentIdString智能体标识(类型 `String`)。The agent id.
textString文本(类型 `String`)。The text.
返回Returns Mono<String>
返回Mono。Returns mono.
源码Source io/agentscope/builder/web/managed/ManagedSessionChannelBridge.java:92–95
基于官方固定版本源码静态生成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.