Skip to main content

Module middleware

Module middleware 

Source
Expand description

Middleware module — Hook chain management

Re-exports§

pub use bridge::build_hooks;
pub use builtins::ContentFilterMiddleware;
pub use builtins::LoggingMiddleware;
pub use builtins::RateLimitMiddleware;
pub use builtins::TokenBudgetMiddleware;
pub use hook::HookMiddleware;
pub use plugin::PluginLoader;
pub use plugin::PluginManifest;

Modules§

bridge
Bridge connecting the legacy hooks API to the middleware pipeline.
builtins
Built-in middleware implementations
hook
HookMiddleware — bridges the HookRunner port into the pipeline so Pre/PostToolUse fire alongside audit/authorizer. HookMiddleware — bridge HookRunner into the existing MiddlewarePipeline so Pre/PostToolUse hooks fire through the same path as audit/authorizer middlewares.
observability_adapters
Adapters that bridge SDK observability/security types (AuditLog, Authorizer) into the Middleware pipeline so they compose with user middlewares instead of overwriting the AgentHooks struct. See module docs for design rationale. Observability adapters — bridges for SDK observability types into the Middleware pipeline so they cooperate with user-added middleware instead of overwriting it.
plugin
Plugin loader for dynamic middleware loading

Structs§

MiddlewareContext
Context passed to middleware during execution.
MiddlewarePipeline
Ordered chain of middlewares executed phase by phase.
MiddlewareResult
Result of middleware execution.

Enums§

MiddlewareAction
Middleware action — determines how the pipeline continues.
MiddlewareData
Middleware data — context passed to middlewares per phase.
MiddlewarePhase
Middleware execution phase.

Traits§

Middleware
Middleware trait — implement this to add behavior to the agent pipeline.