类 TaskReminderMiddleware
java.lang.Object
io.agentscope.core.middleware.TaskReminderMiddleware
- 所有已实现的接口:
MiddlewareBase
Keeps the agent's todo list in front of the model so long-running tasks don't drift.
Two hooks:
onSystemPrompt(io.agentscope.core.agent.Agent, io.agentscope.core.agent.RuntimeContext, java.lang.String)appends a one-time, static explanation of how to use thetodo_writetool (grounding).onReasoning(io.agentscope.core.agent.Agent, io.agentscope.core.agent.RuntimeContext, io.agentscope.core.middleware.ReasoningInput, java.util.function.Function<io.agentscope.core.middleware.ReasoningInput, reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>>)appends a fresh<system-reminder>rendering the currentAgentState.tasksContextbefore every reasoning step, so the model always sees the latest state regardless of how many tool calls happened since.
The reminder is appended transiently to the reasoning input only; it is never written
into AgentState.context, so it is never
persisted, compacted, or recalled. It is additionally tagged with
Msg.METADATA_SYNTHETIC so any consumer that does observe it can skip it.
Unlike opencode (which leaves the latest list in the most recent tool output), agentscope
re-injects the list every turn: after conversation compaction the tool output may be gone, but
tasksContext survives, so this middleware guarantees the list is always visible.
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明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).reactor.core.publisher.Mono<String> onSystemPrompt(Agent agent, RuntimeContext ctx, String currentPrompt) Transform the system prompt string (pipeline pattern).从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 io.agentscope.core.middleware.MiddlewareBase
onActing, onAgent, onModelCall
-
构造器详细资料
-
TaskReminderMiddleware
public TaskReminderMiddleware()
-
-
方法详细资料
-
onSystemPrompt
public reactor.core.publisher.Mono<String> onSystemPrompt(Agent agent, RuntimeContext ctx, String currentPrompt) 从接口复制的说明:MiddlewareBaseTransform the system prompt string (pipeline pattern).Multiple middlewares are applied sequentially; each receives the output of the previous one.
- 指定者:
onSystemPrompt在接口中MiddlewareBase- 参数:
agent- the agent instancectx- per-call runtime context (session, user, attributes)currentPrompt- the current system prompt- 返回:
- the (possibly transformed) system prompt
-
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
-