---
title: "Take While"
description: "Local-first visual environment for building and running AI workflows. Build agents visually, deploy anywhere, privacy by design."
canonical: https://docs.nodetool.ai/nodes/nodetool/control/takewhile
markdown: https://docs.nodetool.ai/nodes/nodetool/control/takewhile.md
product: NodeTool
source: https://github.com/nodetool-ai/nodetool/blob/main/docs/nodes/nodetool/control/takewhile.md
---

# Take While

**Type:** `nodetool.control.TakeWhile`

**Namespace:** `nodetool.control`

## Description

Pass items through while a predicate is truthy. Stops at the first failure.
    take, while, predicate, stream, prefix

    Use cases:
    - Stream until a sentinel/terminator is reached
    - Process items while a confidence threshold holds
    - Cleaner than counting when N is unknown up front

## Properties

| Property | Type | Description | Default |
|----------|------|-------------|---------|
| input_item | `any` | Streaming input. | null |
| predicate | `str` | Safe expression evaluated per item (comparisons, boolean logic, arithmetic, property access on `item`). Stream stops at the first item where the predicate is falsy. | `true` |

## Outputs

| Output | Type | Description |
|--------|------|-------------|
| output | `any` |  |

## Related Nodes

Browse other nodes in the [nodetool.control](./) namespace.
