# Human-in-the-Loop Nodes

Nodes that pause the workflow to request user input. These require the `flowdrop_interrupt` module and the **StateGraph** orchestrator.

For a guide on building workflows with these nodes, see [Human-in-the-Loop Workflows](../human-in-the-loop.md).

---

## Confirmation

Pauses the workflow and presents a Yes/No confirmation prompt to the user.

**Category:** Human-in-the-Loop

### Configuration

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| **message** | String | Yes | — | The question to display (e.g., "Proceed with deletion?") |
| **confirm_label** | String | No | `Yes` | Label for the confirm button |
| **cancel_label** | String | No | `No` | Label for the cancel button |

### Output Ports

| Port | Type | Description |
|------|------|-------------|
| **confirmed** | Boolean | `true` if the user clicked confirm, `false` if cancelled |
| **response_time** | Number | Seconds the user took to respond |
| **user_id** | Number | ID of the user who responded |

### Gateway Mode

The Confirmation node can also function as a gateway (diamond shape), producing **True** and **False** branches instead of a boolean output. This lets you route execution directly based on the user's choice.

---

## Choice Input

Pauses the workflow and presents a list of options for the user to choose from.

**Category:** Human-in-the-Loop

### Configuration

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| **message** | String | Yes | — | The prompt text (e.g., "Select a priority level") |
| **options** | Array | Yes | — | List of available choices |
| **multiple** | Boolean | No | false | Allow selecting multiple options |
| **min_selections** | Number | No | — | Minimum number of selections (multi-select mode) |
| **max_selections** | Number | No | — | Maximum number of selections (multi-select mode) |

### Output Ports

| Port | Type | Description |
|------|------|-------------|
| **selected** | Mixed | The selected option(s) — string for single, array for multiple |
| **selection_count** | Number | Number of options selected |
| **response_time** | Number | Seconds the user took to respond |
| **user_id** | Number | ID of the user who responded |

---

## Text Input (Interrupt)

Pauses the workflow and presents a text input field for free-form user input.

!!! note
    This is different from the **Text Input** node in the Text & Output category. That node provides a static value; this one pauses the workflow and waits for the user to type a response.

**Category:** Human-in-the-Loop

### Configuration

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| **message** | String | Yes | — | The prompt text (e.g., "Enter a reason for rejection") |
| **placeholder** | String | No | — | Placeholder text in the input field |
| **multiline** | Boolean | No | false | Allow multi-line text input |
| **min_length** | Number | No | — | Minimum text length |
| **max_length** | Number | No | — | Maximum text length |
| **default_value** | String | No | — | Pre-filled value |

### Output Ports

| Port | Type | Description |
|------|------|-------------|
| **text** | String | The text entered by the user |
| **length** | Number | Character count of the response |
| **response_time** | Number | Seconds the user took to respond |
| **user_id** | Number | ID of the user who responded |

---

## Form Input

Pauses the workflow and presents a structured form generated from a JSON Schema definition. Use this for collecting multiple fields of structured data.

**Category:** Human-in-the-Loop

### Configuration

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| **message** | String | Yes | The prompt text displayed above the form |
| **schema** | Object | Yes | JSON Schema defining the form fields |
| **default_values** | Object | No | Pre-filled values for form fields |

### Output Ports

| Port | Type | Description |
|------|------|-------------|
| **data** | Object | The submitted form data as a key-value object |
| **response_time** | Number | Seconds the user took to respond |
| **user_id** | Number | ID of the user who responded |

### Example Schema

```json
{
  "type": "object",
  "properties": {
    "name": { "type": "string", "title": "Full Name" },
    "email": { "type": "string", "format": "email", "title": "Email" },
    "priority": {
      "type": "string",
      "enum": ["low", "medium", "high"],
      "title": "Priority"
    }
  },
  "required": ["name", "email"]
}
```

This generates a form with a text field for name, an email field, and a dropdown for priority.
