类 GracefulShutdownMiddleware
- 所有已实现的接口:
MiddlewareBase
Per-call request registration and unregistration are handled by AgentBase.call():
each call registers a distinct requestId (carried on the Reactor Context under AgentBase.SHUTDOWN_REQUEST_ID_KEY) and unregisters it via
doFinally, guaranteeing that every registered request is always unregistered regardless
of success, error, or cancel — and that concurrent calls on one agent instance are tracked
independently.
This middleware is responsible for:
onAgent— deduplicate input if resuming from a shutdown-interrupted sessiononReasoning(doOnComplete) — checkpoint after reasoningonActing(doOnComplete) — checkpoint after acting
Shutdown checkpoints — when the system is in SHUTTING_DOWN state, the agent is interrupted at these safe points (after the current phase has fully completed), so reasoning/acting are allowed to complete before the interrupt is issued — output tokens are not wasted. Only when the global shutdown timeout is reached will the agent be force-interrupted mid-phase (handled by GracefulShutdownManager#enforceTimeoutAndInterrupt).
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明reactor.core.publisher.Flux<AgentEvent> onActing(Agent agent, RuntimeContext ctx, ActingInput input, Function<ActingInput, reactor.core.publisher.Flux<AgentEvent>> next) Intercept the tool-call execution phase.reactor.core.publisher.Flux<AgentEvent> onReasoning(Agent agent, RuntimeContext ctx, ReasoningInput input, Function<ReasoningInput, reactor.core.publisher.Flux<AgentEvent>> next) Intercept the reasoning phase (LLM call + streaming output parsing).从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 io.agentscope.core.middleware.MiddlewareBase
onAgent, onModelCall, onSystemPrompt
-
构造器详细资料
-
GracefulShutdownMiddleware
-
-
方法详细资料
-
onReasoning
public reactor.core.publisher.Flux<AgentEvent> onReasoning(Agent agent, RuntimeContext ctx, ReasoningInput input, Function<ReasoningInput, reactor.core.publisher.Flux<AgentEvent>> next) 从接口复制的说明:MiddlewareBaseIntercept the reasoning phase (LLM call + streaming output parsing).- 指定者:
onReasoning在接口中MiddlewareBase- 参数:
agent- the agent instancectx- per-call runtime context (session, user, attributes)input- reasoning input (messages, tools, options)next- calls the next middleware or the core reasoning logic- 返回:
- event stream from reasoning
-
onActing
public reactor.core.publisher.Flux<AgentEvent> onActing(Agent agent, RuntimeContext ctx, ActingInput input, Function<ActingInput, reactor.core.publisher.Flux<AgentEvent>> next) 从接口复制的说明:MiddlewareBaseIntercept the tool-call execution phase.- 指定者:
onActing在接口中MiddlewareBase- 参数:
agent- the agent instancectx- per-call runtime context (session, user, attributes)input- acting input (the tool calls)next- calls the next middleware or the core acting logic- 返回:
- event stream from acting
-