Class AistioObserverMiddleware

java.lang.Object
io.agentscope.extensions.aistio.adapter.AistioObserverMiddleware
All Implemented Interfaces:
io.agentscope.core.middleware.MiddlewareBase

public final class AistioObserverMiddleware extends Object implements io.agentscope.core.middleware.MiddlewareBase
Middleware that copies conversation activity out to aistio without touching it.

Purely additive: inputs are forwarded to next unchanged and the resulting event stream is only tapped, never rewritten or filtered. Removing this middleware changes nothing about how the agent behaves.

Tool call arguments are read in onActing(io.agentscope.core.agent.Agent, io.agentscope.core.agent.RuntimeContext, io.agentscope.core.middleware.ActingInput, java.util.function.Function<io.agentscope.core.middleware.ActingInput, reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>>), because ToolCallEndEvent carries only the call's name and id. Tool output text is reassembled from the delta events, which is the only place the framework exposes it incrementally.

  • Method Summary

    Modifier and Type
    Method
    Description
    reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>
    onActing(io.agentscope.core.agent.Agent agent, io.agentscope.core.agent.RuntimeContext ctx, io.agentscope.core.middleware.ActingInput input, Function<io.agentscope.core.middleware.ActingInput,reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>> next)
     
    reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>
    onAgent(io.agentscope.core.agent.Agent agent, io.agentscope.core.agent.RuntimeContext ctx, io.agentscope.core.middleware.AgentInput input, Function<io.agentscope.core.middleware.AgentInput,reactor.core.publisher.Flux<io.agentscope.core.event.AgentEvent>> next)
     
    reactor.core.publisher.Mono<String>
    onSystemPrompt(io.agentscope.core.agent.Agent agent, io.agentscope.core.agent.RuntimeContext ctx, String currentPrompt)
    Captures the fully composed system prompt when this middleware is registered last in the onSystemPrompt chain (paw wires aistio after other middlewares).

    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

    onModelCall, onReasoning, order
  • Method Details

    • onAgent

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

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

      public reactor.core.publisher.Mono<String> onSystemPrompt(io.agentscope.core.agent.Agent agent, io.agentscope.core.agent.RuntimeContext ctx, String currentPrompt)
      Captures the fully composed system prompt when this middleware is registered last in the onSystemPrompt chain (paw wires aistio after other middlewares).
      Specified by:
      onSystemPrompt in interface io.agentscope.core.middleware.MiddlewareBase