AS AgentScopeAPI 手册 / API Reference

MiddlewareChain

public final class MiddlewareChain
源码Source io/agentscope/core/middleware/MiddlewareChain.java:31–78

中间件 Chain,驱动智能体的推理、工具调用与会话执行。位于 io.agentscope.core.middleware 包。核心成员包括 build。

Builds an onion-style middleware chain for a given interception point.

The chain is constructed back-to-front: the last middleware wraps the core logic, and the first middleware is the outermost wrapper.

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
MiddlewareMethod接口interface
定义中间件方法契约的接口。
Functional interface representing one of the onion-pattern middleware hooks.

方法摘要Method Summary

方法Method说明Description
public static I Function<I, Flux<AgentEvent>> build(List<? extends MiddlewareBase> middlewares, Agent agent, RuntimeContext ctx, MiddlewareMethod<I> method, Function<I, Flux<AgentEvent>> core)
static
构建并返回最终实例。
Build a middleware chain that produces `Flux<AgentEvent>`.

方法详情Method Detail

build

public static I Function<I, Flux<AgentEvent>> build(List<? extends MiddlewareBase> middlewares, Agent agent, RuntimeContext ctx, MiddlewareMethod<I> method, Function<I, Flux<AgentEvent>> core)
static

构建并返回最终实例。

Build a middleware chain that produces Flux.

参数Parameters
名称Name类型Type说明Description
middlewaresList<? extends MiddlewareBase>中间件列表(类型 `List`)。ordered list of middlewares (first = outermost)
agentAgent智能体(类型 `Agent`)。the agent instance passed to each middleware
ctxRuntimeContext运行时上下文(类型 `RuntimeContext`)。per-call runtime context passed to each middleware
methodMiddlewareMethod<I>方法(类型 `MiddlewareMethod`)。reference to the middleware hook method
coreFunction<I, Flux<AgentEvent>>核心(类型 `Function >`)。the innermost logic to execute when all middlewares delegate
返回Returns Function<I, Flux<AgentEvent>>
返回函数>。a function that, when applied to an input, runs the full chain
源码Source io/agentscope/core/middleware/MiddlewareChain.java:46–62

嵌套类详情Nested Class Detail

MiddlewareMethod

@FunctionalInterface public interface MiddlewareMethod<I>

定义中间件方法契约的接口。位于 io.agentscope.core.middleware 包。核心成员包括 apply。

Functional interface representing one of the onion-pattern middleware hooks.

基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.