类 TaskReminderMiddleware

java.lang.Object
io.agentscope.core.middleware.TaskReminderMiddleware
所有已实现的接口:
MiddlewareBase

public class TaskReminderMiddleware extends Object implements MiddlewareBase
Keeps the agent's todo list in front of the model so long-running tasks don't drift.

Two hooks:

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.

  • 构造器详细资料

    • TaskReminderMiddleware

      public TaskReminderMiddleware()
  • 方法详细资料

    • onSystemPrompt

      public reactor.core.publisher.Mono<String> onSystemPrompt(Agent agent, RuntimeContext ctx, String currentPrompt)
      从接口复制的说明: MiddlewareBase
      Transform the system prompt string (pipeline pattern).

      Multiple middlewares are applied sequentially; each receives the output of the previous one.

      指定者:
      onSystemPrompt 在接口中 MiddlewareBase
      参数:
      agent - the agent instance
      ctx - 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)
      从接口复制的说明: MiddlewareBase
      Intercept the reasoning phase (LLM call + streaming output parsing).
      指定者:
      onReasoning 在接口中 MiddlewareBase
      参数:
      agent - the agent instance
      ctx - 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