> ## Documentation Index
> Fetch the complete documentation index at: https://orangeslice.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Workflows

> Orchestrate execution with sleep and halt

<Frame>
  <iframe width="100%" height="400" src="https://www.youtube.com/embed/JyM_-0nY1Yo" title="Workflow Control in Orange Slice" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />
</Frame>

## Overview

The `ctx` object provides workflow control methods that help you manage execution timing and optimize resource usage.

## Methods

### sleep()

Pause execution for a specified duration.

```typescript theme={null}
ctx.sleep(milliseconds: number): Promise<void>
```

**Example:**

```typescript theme={null}
await ctx.sleep(1000); // Sleep for 1 second
```

### halt()

Signal to the workflow orchestrator that this column's result makes all other columns in the row pointless. This helps the system avoid wasted parallel work.

```typescript theme={null}
ctx.halt(reason?: string): void
```

<Warning>
  `halt()` should only be used AFTER expensive operations when the result disqualifies the entire row. Don't use it for simple validation or early returns.
</Warning>

**Example:**

```typescript theme={null}
const analysis = await services.ai.generateObject({
   prompt: `Analyze if ${companyName} is in our ICP`,
   schema: z.object({ isICP: z.boolean() }),
});

if (!analysis.object.isICP) {
   ctx.halt("Not in ICP");
   return false;
}
```
