ToolEventBus
@Component public class ToolEventBus
源码Source
io/agentscope/builder/web/toolbus/ToolEventBus.java:30–66工具事件总线,承载智能体的部署、调度与服务化运行。位于 io.agentscope.builder.web.toolbus 包。核心成员包括 publish、subscribe。
Singleton in-memory event bus for tool-call events emitted by HarnessAgent hooks.
Consumers subscribe via #subscribe(String) filtering by session key.
Publishers call #publish(ToolEvent) from the hook when a tool call is about to execute.
嵌套类摘要Nested Class Summary
| 类Class | 类型Kind | 说明Description |
|---|---|---|
ToolEvent | 记录record | 承载工具事件数据的记录类型。 A single tool-call or tool-result event. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public void publish(ToolEvent event) | 设置发布。 Publishes a tool-call event to all current subscribers. |
public Flux<ToolEvent> subscribe(String sessionKey) | 设置订阅。 Returns a `Flux` filtered to events matching the given session key. |
方法详情Method Detail
publish
public void publish(ToolEvent event)
设置发布。
Publishes a tool-call event to all current subscribers.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
event | ToolEvent | 事件(类型 `ToolEvent`)。The event. |
源码Source
io/agentscope/builder/web/toolbus/ToolEventBus.java:37–39subscribe
public Flux<ToolEvent> subscribe(String sessionKey)
设置订阅。
Returns a Flux filtered to events matching the given session key.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sessionKey | String | 会话键(类型 `String`)。The session key. |
Flux<ToolEvent>返回Flux。Returns flux.
源码Source
io/agentscope/builder/web/toolbus/ToolEventBus.java:45–47嵌套类详情Nested Class Detail
ToolEvent
@JsonInclude(JsonInclude.Include.NON_NULL) public record ToolEvent( String sessionKey, String eventType, String toolName, Map<String, Object> data)承载工具事件数据的记录类型。位于 io.agentscope.builder.web.toolbus 包。核心成员包括 sessionKey、eventType、toolName、data、toolCall。
A single tool-call or tool-result event.