> ## 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 Chain • AI Agent SDK

> MiddlewareChain: Synchronous middleware chain executor.

# MiddlewareChain

> Defined in the [**middleware**](../modules/middleware) module.

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

Synchronous middleware chain executor.

Composes middleware functions in registration order.
First registered middleware wraps all subsequent ones.

## Constructor

<ParamField query="middlewares" type="Optional" required={false}>
  No description available.
</ParamField>

## Methods

<CardGroup cols={2}>
  <Card title="execute()" icon="function" href="../functions/MiddlewareChain-execute">
    Execute the middleware chain with a final handler.
  </Card>
</CardGroup>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/hooks/middleware.py#L102">
  `praisonaiagents/hooks/middleware.py` at line 102
</Card>

***

## Related Documentation

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