AS AgentScopeAPI 手册 / API Reference

AgentProtocolTaskEventBus

public final class AgentProtocolTaskEventBus implements AgentProtocolEventBus
源码Source io/agentscope/extensions/agentprotocol/AgentProtocolTaskEventBus.java:31–91

智能体协议任务事件总线,为框架提供通用类型与基础能力。位于 io.agentscope.extensions.agentprotocol 包,实现 AgentProtocolEventBus。核心成员包括 publish、subscribe、complete、AgentProtocolTaskEventBus。

Per-task event bus for Agent Protocol SSE streaming. Uses a replay buffer so late subscribers / reconnects can catch up from fromSeq.

构造器摘要Constructor Summary

构造器Constructor说明Description
public AgentProtocolTaskEventBus()
初始化 `AgentProtocolTaskEventBus` 实例。
Creates a new instance.
public AgentProtocolTaskEventBus(int replayBufferSize)
初始化 `AgentProtocolTaskEventBus` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public RemoteAgentEvent publish(String taskId, RemoteAgentEvent event)
执行发布相关操作。
Publishes an event, assigning a monotonic `seq`.
public Flux<RemoteAgentEvent> subscribe(String taskId, long fromSeq)
执行订阅相关操作。
Subscribes to events for `taskId`, optionally skipping those with `seq <= fromSeq`.
public void complete(String taskId)
设置该参数。
Completes and removes the channel after a terminal event has been published.

构造器详情Constructor Detail

AgentProtocolTaskEventBus

public AgentProtocolTaskEventBus()

初始化 AgentProtocolTaskEventBus 实例。

Creates a new instance.

源码Source io/agentscope/extensions/agentprotocol/AgentProtocolTaskEventBus.java:38–40

AgentProtocolTaskEventBus

public AgentProtocolTaskEventBus(int replayBufferSize)

初始化 AgentProtocolTaskEventBus 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
replayBufferSizeintreplay Buffer 大小(类型 `int`)。The replay buffer size.
源码Source io/agentscope/extensions/agentprotocol/AgentProtocolTaskEventBus.java:42–44

方法详情Method Detail

publish

public RemoteAgentEvent publish(String taskId, RemoteAgentEvent event)

执行发布相关操作。

Publishes an event, assigning a monotonic seq.

参数Parameters
名称Name类型Type说明Description
taskIdString任务标识(类型 `String`)。The task id.
eventRemoteAgentEvent事件(类型 `RemoteAgentEvent`)。The event.
返回Returns RemoteAgentEvent
返回RemoteAgentEvent。Returns remote agent event.
源码Source io/agentscope/extensions/agentprotocol/AgentProtocolTaskEventBus.java:47–58

subscribe

public Flux<RemoteAgentEvent> subscribe(String taskId, long fromSeq)

执行订阅相关操作。

Subscribes to events for taskId, optionally skipping those with seq <= fromSeq.

参数Parameters
名称Name类型Type说明Description
taskIdString任务标识(类型 `String`)。The task id.
fromSeqlong来自 Seq(类型 `long`)。The from seq.
返回Returns Flux<RemoteAgentEvent>
返回Flux。Returns flux.
源码Source io/agentscope/extensions/agentprotocol/AgentProtocolTaskEventBus.java:64–72

complete

public void complete(String taskId)

设置该参数。

Completes and removes the channel after a terminal event has been published.

参数Parameters
名称Name类型Type说明Description
taskIdString任务标识(类型 `String`)。The task id.
源码Source io/agentscope/extensions/agentprotocol/AgentProtocolTaskEventBus.java:75–81
基于官方固定版本源码静态生成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.