> ## 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.

# Run Before Model • AI Agent SDK

> run_before_model: Run all before_model hooks.

# run\_before\_model

<div className="flex items-center gap-2">
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**MiddlewareManager**](../classes/MiddlewareManager) class in the [**middleware**](../modules/middleware) module.

Run all before\_model hooks.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def run_before_model(request: ModelRequest) -> ModelRequest
```

## Parameters

<ParamField query="request" type="ModelRequest" required={true}>
  No description available.
</ParamField>

### Returns

<ResponseField name="Returns" type="ModelRequest">
  The result of the operation.
</ResponseField>

## Uses

* `hook`

## Used By

* [`MiddlewareManager.execute_model_call`](../functions/MiddlewareManager-execute_model_call)

## Source

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