AS AgentScopeAPI 手册 / API Reference

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
busToolEventBus总线(类型 `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
agentAgent智能体(类型 `Agent`)。The agent.
ctxRuntimeContext运行时上下文(类型 `RuntimeContext`)。The ctx.
inputActingInput输入消息(类型 `ActingInput`)。The input.
nextFunction<ActingInput, Flux<AgentEvent>>下一个(类型 `Function >`)。The next.
返回Returns Flux<AgentEvent>
返回Flux。Returns flux.
源码Source io/agentscope/builder/web/toolbus/ToolNotificationMiddleware.java:50–79

继承成员Inherited Members

基于官方固定版本源码静态生成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.