Class InboxMiddleware

java.lang.Object
io.agentscope.harness.agent.middleware.InboxMiddleware
All Implemented Interfaces:
io.agentscope.core.middleware.MiddlewareBase, HarnessRuntimeMiddleware

public class InboxMiddleware extends Object implements HarnessRuntimeMiddleware
Middleware that drains the message bus inbox before each reasoning step and injects the messages as HintBlocks into the agent's context.

Producers (e.g. AsyncToolMiddleware, team tools, schedulers) push HintBlock payloads into the per-session inbox via MessageBus.inboxPush(java.lang.String, java.util.Map<java.lang.String, java.lang.Object>). This middleware drains them at the start of each reasoning step, appends them to the agent's context, and emits a HintBlockEvent for each so the front-end event stream can render them in real time.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
    InboxMiddleware(MessageBus messageBus, int maxDrainCount)
     
    InboxMiddleware(MessageBus messageBus, int maxDrainCount, AsyncToolRegistry asyncToolRegistry, Duration staleTtl)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>
    onReasoning(io.agentscope.core.agent.Agent agent, io.agentscope.core.agent.RuntimeContext ctx, io.agentscope.core.middleware.ReasoningInput input, Function<io.agentscope.core.middleware.ReasoningInput,reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>> next)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.agentscope.core.middleware.MiddlewareBase

    onActing, onAgent, onModelCall, onSystemPrompt, order
  • Constructor Details

    • InboxMiddleware

      public InboxMiddleware(MessageBus messageBus)
    • InboxMiddleware

      public InboxMiddleware(MessageBus messageBus, int maxDrainCount)
    • InboxMiddleware

      public InboxMiddleware(MessageBus messageBus, int maxDrainCount, AsyncToolRegistry asyncToolRegistry, Duration staleTtl)
  • Method Details

    • onReasoning

      public reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent> onReasoning(io.agentscope.core.agent.Agent agent, io.agentscope.core.agent.RuntimeContext ctx, io.agentscope.core.middleware.ReasoningInput input, Function<io.agentscope.core.middleware.ReasoningInput,reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>> next)
      Specified by:
      onReasoning in interface io.agentscope.core.middleware.MiddlewareBase