---
title: sleep
description: Suspend a workflow for a duration or until a date without consuming resources.
docs_index: /llms.txt
lastUpdated: 2026-10-13
type: reference
summary: Use sleep to suspend a workflow for a duration or until a specific date without consuming resources.
prerequisites:
  - /docs/foundations/workflows-and-steps
related:
  - /docs/ai/sleep-and-delays
---

> For an index of all documentation, see [/llms.txt](/llms.txt).

Suspends a workflow for a specified duration or until an end date without consuming any resources. Once the duration or end date passes, the workflow will resume execution.

This is useful when you want to resume a workflow after some duration or date.

> `sleep` is a built-in workflow runtime function (backed by a timer event in the event log, not a step) and should be called directly inside workflow functions.

```typescript lineNumbers
import { sleep } from "workflow"

async function testWorkflow() {
    "use workflow"
    await sleep("10s") // [!code highlight]
}
```

## API signature

### Parameters

## Examples

### Sleeping with a duration

You can specify a duration for `sleep` to suspend the workflow for a fixed amount of time.

```typescript lineNumbers
import { sleep } from "workflow"

async function testWorkflow() {
    "use workflow"
    await sleep("1d") // [!code highlight]
}
```

### Sleeping until an end date

You can specify a future `Date` object for `sleep` to suspend the workflow until a specific date.

```typescript lineNumbers
import { sleep } from "workflow"

async function testWorkflow() {
    "use workflow"
    await sleep(new Date(Date.now() + 10_000)) // [!code highlight]
}
```

---

For a semantic overview of all documentation, see [/sitemap.md](/sitemap.md)

For an index of all available documentation, see [/llms.txt](/llms.txt)

For agent-facing discovery, including API and MCP surfaces, see [/agents.md](/agents.md)