> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# middleware • AI Agent SDK

> Runtime Tool Result Middleware Protocol.

# middleware

<Badge color="blue">AI Agent</Badge>

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

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents.runtime import middleware
```

## Classes

<CardGroup cols={2}>
  <Card title="MiddlewareContext" icon="brackets-curly" href="../classes/MiddlewareContext">
    Context passed to middleware during tool result normalization.
  </Card>

  <Card title="NormalizedToolResult" icon="brackets-curly" href="../classes/NormalizedToolResult">
    Standardized tool result format.
  </Card>

  <Card title="RuntimeToolResultMiddleware" icon="brackets-curly" href="../classes/RuntimeToolResultMiddleware">
    Protocol for runtime-scoped tool result middleware.
  </Card>

  <Card title="PassThroughMiddleware" icon="brackets-curly" href="../classes/PassThroughMiddleware">
    Default middleware that passes results through without modification.
  </Card>
</CardGroup>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Middleware Feature" icon="layer-group" href="/docs/docs/features/middleware" />
</CardGroup>
