Skip to main content

middleware

AI Agent Runtime Tool Result Middleware Protocol. Defines the interface for normalizing tool results from plugin harnesses before they reach hooks and memory adapters. Protocol-driven design following AGENTS.md:
  • Lightweight protocols only (no implementations)
  • Dataclasses for configuration
  • Async-first with proper typing

Import

Classes

MiddlewareContext

Context passed to middleware during tool result normalization.

NormalizedToolResult

Standardized tool result format.

RuntimeToolResultMiddleware

Protocol for runtime-scoped tool result middleware.

PassThroughMiddleware

Default middleware that passes results through without modification.

Middleware Feature