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

# No Model Requests • AI Agent SDK

> no_model_requests: Block real model requests for the duration of the ``with`` block.

# no\_model\_requests

<div className="flex items-center gap-2">
  <Badge color="teal">Function</Badge>
</div>

> This function is defined in the [**guard**](../modules/guard) module.

Block real model requests for the duration of the `with` block.

Composes with a suite-wide :func:`allow_model_requests` call and with other
`no_model_requests` blocks. Rather than saving and restoring the global
flag -- which lets an inner or cross-thread scope exiting first re-enable
requests while an outer scope is still open -- this increments a block
counter, so requests stay blocked until *every* open scope has exited::

with no\_model\_requests():
agent.start("hello")  # raises ModelRequestBlocked

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def no_model_requests() -> Iterator[None]
```

### Returns

<ResponseField name="Returns" type="Iterator[None]">
  The result of the operation.
</ResponseField>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/model_harness/guard.py#L140">
  `praisonaiagents/model_harness/guard.py` at line 140
</Card>
