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 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 |
|---|---|---|
middlewares | List<? extends MiddlewareBase> | 中间件列表(类型 `List`)。ordered list of middlewares (first = outermost) |
agent | Agent | 智能体(类型 `Agent`)。the agent instance passed to each middleware |
ctx | RuntimeContext | 运行时上下文(类型 `RuntimeContext`)。per-call runtime context passed to each middleware |
method | MiddlewareMethod<I> | 方法(类型 `MiddlewareMethod`)。reference to the middleware hook method |
core | Function<I, Flux<AgentEvent>> | 核心(类型 `Function >`)。the innermost logic to execute when all middlewares delegate |
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.