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

# Interruptible Sleep • AI Agent SDK

> interruptible_sleep: Sleep with periodic interruption checks.

# interruptible\_sleep

AsyncFunction

> This function is defined in the [**retry\_utils**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/retry_utils.md) module.

Sleep with periodic interruption checks.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
async def interruptible_sleep(seconds: float, check_interval: float, interrupt_fn: Optional[Callable[[], bool]]) -> bool
```

## Parameters

**seconds** `float` *required*

Total sleep duration in seconds

**check\_interval** `float` (default: 0.2)

How often to check for interruption (seconds)

**interrupt\_fn** `Optional`

Function that returns True if sleep should be interrupted

### Returns

**Returns** `bool`

True if completed full sleep, False if interrupted

## Usage

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
>>> interrupted = await interruptible_sleep(30.0, interrupt_fn=lambda: agent.is_stopped())
```

## Uses

* `interrupt_fn`
* `asyncio.sleep`

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/agent/retry_utils.py#L70)
>
> `praisonaiagents/agent/retry_utils.py` at line 70


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.