ToolNotificationMiddleware
public class ToolNotificationMiddleware implements MiddlewareBase
源码Source
io/agentscope/builder/web/toolbus/ToolNotificationMiddleware.java:40–88工具通知中间件,在智能体执行流程中提供横切扩展。位于 io.agentscope.builder.web.toolbus 包,实现 MiddlewareBase。核心成员包括 onActing、ToolNotificationMiddleware。
MiddlewareBase implementation that publishes tool-call events to ToolEventBus
before each tool-call execution, enabling real-time SSE streaming of tool calls in
io.agentscope.builder.web.api.DataSessionApiController.
The session key is derived from RuntimeContext#getSessionId() (falling back to
RuntimeContext#getUserId()) on the in-flight call, accessed via the agent's
getRuntimeContext().
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public ToolNotificationMiddleware(ToolEventBus bus) | 初始化 `ToolNotificationMiddleware` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Flux<AgentEvent> onActing(Agent agent, RuntimeContext ctx, ActingInput input, Function<ActingInput, Flux<AgentEvent>> next) | 处理执行事件。 Performs the on acting operation. |
构造器详情Constructor Detail
ToolNotificationMiddleware
public ToolNotificationMiddleware(ToolEventBus bus)
初始化 ToolNotificationMiddleware 实例。
Creates a new instance.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
bus | ToolEventBus | 总线(类型 `ToolEventBus`)。The bus. |
源码Source
io/agentscope/builder/web/toolbus/ToolNotificationMiddleware.java:46–48方法详情Method Detail
onActing
public Flux<AgentEvent> onActing(Agent agent, RuntimeContext ctx, ActingInput input, Function<ActingInput, Flux<AgentEvent>> next)
处理执行事件。
Performs the on acting operation.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agent | Agent | 智能体(类型 `Agent`)。The agent. |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。The ctx. |
input | ActingInput | 输入消息(类型 `ActingInput`)。The input. |
next | Function<ActingInput, Flux<AgentEvent>> | 下一个(类型 `Function >`)。The next. |
Flux<AgentEvent>返回Flux。Returns flux.
源码Source
io/agentscope/builder/web/toolbus/ToolNotificationMiddleware.java:50–79