Skip to main content

Module middleware

Module middleware 

Source
Expand description

Middleware pipelines for agents, chat clients, and function invocation.

Rust equivalent of agent_framework._middleware. Middleware receives an owned context and a Next continuation. Call next.run(ctx) to continue the chain, mutate the context to observe/override results, or return the context directly (optionally with terminate = true) to short-circuit.

Structs§

AgentContext
Context flowing through the agent middleware pipeline.
ChatContext
Context flowing through the chat middleware pipeline.
FnMiddleware
Adapter to build a Middleware from an async closure.
FunctionInvocationContext
Context flowing through the function middleware pipeline.
LiveToolList
The live, mutable tool list of an in-flight agent run (progressive tool exposure).
MiddlewarePipeline
A pipeline of middleware of a single category.
Next
The continuation passed to a Middleware. Calling Next::run invokes the remaining middleware and, finally, the terminal handler.

Traits§

Middleware
A middleware that transforms a context of type C.

Type Aliases§

AgentMiddleware
Convenience type aliases for each middleware category.
ChatMiddleware
Chat middleware operates on a ChatContext.
FunctionMiddleware
Function middleware operates on a FunctionInvocationContext.
Terminal
The terminal handler invoked at the end of a middleware chain.