# Transform, control and output

Templates, JSON handling, code, type conversion, branching, loops, joins and outputs.

Source: https://glamorous-boar.cloudvent.net/nodes/transform-and-control/

---

{/* Generated by scripts/agenticmind/generate-node-docs.mjs from the AgenticMind node registry. Do not edit by hand. */}

These nodes shape data and control flow. Ports are strictly typed, so **To Text** and **Parse JSON** convert explicitly. **Conditional**, **Router**, **Join**, **Loop** and **Loop End** use control edges (branch → `trigger`), which are distinct from data edges. **Output** publishes results and doubles as a run target.

| Node | Category | Summary |
|---|---|---|
| [Conditional](#conditional) | Control flow | Evaluates a condition and activates the ``true`` or ``false`` control branch. |
| [Delay](#delay) | Control flow | Waits, then passes its input through. Useful for testing timeouts and cancellation. |
| [Join](#join) | Control flow | Waits for all incoming control paths, then combines the values from parallel branches. |
| [Loop](#loop) | Control flow | Starts a loop. Wire the body between Loop and Loop End; it runs once per item or iteration. |
| [Loop End](#loop-end) | Control flow | Ends a loop and collects each iteration's value. repeat: 'continue' false stops; 'next_state' (optional) becomes the next iteration's state. |
| [Router](#router) | Control flow | Sends execution down one named route, chosen by rules or by an LLM; 'default' when nothing fits. |
| [Parse JSON](#parse-json) | Convert | Explicitly parses text into a JSON value. |
| [To Text](#to-text) | Convert | Explicitly converts any value to text (strings pass through; others become JSON). |
| [Output](#output) | Output | Publishes its input as a field of the run output. |
| [Code](#code) | Transform | Runs Python or JavaScript in a sandbox (Docker by default) on the connected value. |
| [Collect](#collect) | Transform | Joins several branches into one list (explicit join; order follows edge IDs). |
| [JSON Select](#json-select) | Transform | Selects a value inside a JSON document. |
| [Text Template](#text-template) | Transform | Renders a text template with &#123;&#123; placeholders &#125;&#125;. |
| [Text Transform](#text-transform) | Transform | Applies a simple text operation. |
## Conditional

`agenticmind.core.conditional` · version 1.0.0

Evaluates a condition and activates the ``true`` or ``false`` control branch.

**Typical use.** Evaluates a condition and activates the `true` or `false` control branch. Connect each branch to the `trigger` of the nodes that should run; the other side is skipped.

| Input | Type | Required | Description |
|---|---|---|---|
| `value` | Any | yes |  |

| Output | Type | Description |
|---|---|---|
| `result` | Boolean |  |

- **Control branches:** `true`, `false`
- **Permissions:** none
- **Execution policy:** timeout 30s, max attempts 1, idempotent

| Setting | Type | Default | Description |
|---|---|---|---|
| `operator` | `equals` · `not_equals` · `contains` · `greater_than` · `less_than` · `is_empty` · `is_truthy` | `is_truthy` | Operator |
| `operand` | object |  | Right-hand side (ignored by is_empty / is_truthy). |

## Delay

`agenticmind.core.delay` · version 1.0.0

Waits, then passes its input through. Useful for testing timeouts and cancellation.

**Typical use.** Waits a number of seconds and passes its input through. Mainly useful to test timeouts, cancellation and streaming.

| Input | Type | Required | Description |
|---|---|---|---|
| `value` | Any | no |  |

| Output | Type | Description |
|---|---|---|
| `value` | Any |  |

- **Control branches:** `done`
- **Permissions:** none
- **Execution policy:** timeout 30s, max attempts 1, idempotent

| Setting | Type | Default | Description |
|---|---|---|---|
| `seconds` | number | `1` | Seconds |

## Join

`agenticmind.core.join` · version 1.0.0

Waits for all incoming control paths, then combines the values from parallel branches.

**Typical use.** An AND-join: runs only when every incoming control path was activated, then combines the values (collect, merge or concat). Use it after a Router or Conditional so one output receives whichever branch ran.

| Input | Type | Required | Description |
|---|---|---|---|
| `values` | Any (many) | no |  |

| Output | Type | Description |
|---|---|---|
| `value` | JSON |  |
| `count` | Number | How many values arrived |

- **Control branches:** `done`
- **Control join:** all (runs only if every incoming control edge was activated)
- **Permissions:** none
- **Execution policy:** timeout 30s, max attempts 1, idempotent

| Setting | Type | Default | Description |
|---|---|---|---|
| `mode` | `collect` · `merge` · `concat` | `collect` | collect: list of values. merge: combine objects (later keys win). concat: join as text. |
| `separator` | string | see below | Text between values (concat). |
| `min_values` | integer | `1` | Fail if fewer values arrive (branches that were skipped send none). |

<CodeBlock language="text" filename="Default separator">

```



```

</CodeBlock>

## Loop

`agenticmind.core.loop` · version 1.0.0

Starts a loop. Wire the body between Loop and Loop End; it runs once per item or iteration.

**Typical use.** Starts a loop region. Wire Loop's `scope` to Loop End's `scope`; every node on a path between them is the body. `for_each` runs once per list item (optionally in parallel); `repeat` runs until Loop End's `continue` is false.

| Input | Type | Required | Description |
|---|---|---|---|
| `items` | JSON | no | List to iterate (for_each) |
| `initial` | Any | no | Starting state (repeat) |

| Output | Type | Description |
|---|---|---|
| `item` | Any | Current item |
| `index` | Number | 0-based iteration number |
| `state` | Any | Current state |
| `scope` | LoopScope | Connect to Loop End |

- **Control branches:** `done`
- **Permissions:** none
- **Execution policy:** timeout 30s, max attempts 1, idempotent

| Setting | Type | Default | Description |
|---|---|---|---|
| `mode` | `for_each` · `repeat` | `for_each` | for_each: run the body once per item of a list. repeat: run it again and again, passing the result on as state, until Loop End's 'continue' is false or max iterations is reached. |
| `item_type` | `Any` · `String` · `Number` · `Boolean` · `JSON` | `Any` | Type of each item (for_each). |
| `state_type` | `Any` · `String` · `Number` · `Boolean` · `JSON` | `Any` | Type of the state (repeat). |
| `max_items` | integer | `100` | Largest list a for_each loop accepts. |
| `on_too_many` | `fail` · `truncate` | `fail` | On Too Many |
| `concurrency` | integer | `1` | Items processed at the same time (for_each). 1 = one after another. |
| `on_item_error` | `fail` · `skip` | `fail` | fail: stop the loop on the first failing item. skip: record it and continue. |
| `max_iterations` | integer | `5` | Upper bound for repeat loops. |

## Loop End

`agenticmind.core.loop_end` · version 1.1.0 · older versions kept: 1.0.0

Ends a loop and collects each iteration's value. repeat: 'continue' false stops; 'next_state' (optional) becomes the next iteration's state.

**Typical use.** Closes a loop and collects each iteration's value into `results`. In `repeat` mode, `continue` false stops the loop and `next_state` becomes the next iteration's state (used by the critic reflection loop).

| Input | Type | Required | Description |
|---|---|---|---|
| `scope` | LoopScope | yes | From the Loop's scope output |
| `value` | Any | yes | This iteration's result |
| `continue` | Boolean | no | repeat: false stops |
| `next_state` | Any | no | repeat: state for the next iteration (default: value) |

| Output | Type | Description |
|---|---|---|
| `results` | JSON | Every iteration's value, in order |
| `last` | Any | The final value |
| `report` | JSON | &#123;mode, iterations, stop_reason, errors&#125; |

- **Control branches:** `done`
- **Permissions:** none
- **Execution policy:** timeout 30s, max attempts 1, idempotent

*No configuration.*

## Router

`agenticmind.core.router` · version 1.0.0

Sends execution down one named route, chosen by rules or by an LLM; 'default' when nothing fits.

**Typical use.** Multi-way routing. Each configured route becomes a control branch, plus `default`. `rules` mode (regex, contains, comparisons) is free and offline; `llm` mode lets a model choose through a forced tool call.

| Input | Type | Required | Description |
|---|---|---|---|
| `value` | Any | yes | What to route on |

| Output | Type | Description |
|---|---|---|
| `route` | String | Name of the chosen route |
| `reason` | String |  |

- **Control branches:** `default` plus one per configured item in `routes`
- **Permissions:** `network`, `credentials`
- **Execution policy:** timeout 60s, max attempts 2, idempotent

| Setting | Type | Default | Description |
|---|---|---|---|
| `mode` | `rules` · `llm` | `rules` | rules: first matching route wins. llm: a model picks the best route. |
| `routes` | array | see below | Each route becomes an output branch. Unmatched input goes to 'default'. |
| `case_sensitive` | boolean | `false` | Case Sensitive |
| `provider` | `openrouter` · `openai` · `anthropic` · `gemini` · `azure_openai` · `bedrock` · `mistral` · `groq` · `deepseek` · `together` · `xai` · `huggingface` · `ollama` · `openai_compatible` · `mock` | `openrouter` | Provider |
| `model` | string | `google/gemini-3.8-flash` | Model |
| `api_key` | secret ref |  | API key for llm mode, e.g. OPENROUTER_API_KEY |
| `base_url` | string |  | Base Url |

<CodeBlock language="json" filename="Default routes">

```
[
  {
    "name": "billing",
    "description": "Invoices, refunds, payments, charges",
    "operator": "regex",
    "value": "invoice|refund|charge|payment|billing"
  },
  {
    "name": "technical",
    "description": "Bugs, errors, crashes, login or access problems",
    "operator": "regex",
    "value": "error|bug|crash|login|password|cannot|can't"
  }
]
```

</CodeBlock>

## Parse JSON

`agenticmind.core.parse_json` · version 1.0.0

Explicitly parses text into a JSON value.

**Typical use.** The reverse of To Text: parses a model's text reply into a JSON value so JSON Select or other JSON inputs can use it.

| Input | Type | Required | Description |
|---|---|---|---|
| `text` | String | yes |  |

| Output | Type | Description |
|---|---|---|
| `value` | JSON |  |

- **Control branches:** `done`
- **Permissions:** none
- **Execution policy:** timeout 30s, max attempts 1, idempotent

*No configuration.*

## To Text

`agenticmind.core.to_text` · version 1.0.0

Explicitly converts any value to text (strings pass through; others become JSON).

**Typical use.** Converts any value to text, because ports are strictly typed: JSON never silently becomes a String. Turn on `pretty` for indented JSON.

| Input | Type | Required | Description |
|---|---|---|---|
| `value` | Any | yes |  |

| Output | Type | Description |
|---|---|---|
| `text` | String |  |

- **Control branches:** `done`
- **Permissions:** none
- **Execution policy:** timeout 30s, max attempts 1, idempotent

| Setting | Type | Default | Description |
|---|---|---|---|
| `pretty` | boolean | `false` | Indent JSON output. |

## Output

`agenticmind.core.output` · version 1.0.0

Publishes its input as a field of the run output.

**Typical use.** Publishes a value under `key` in the run output. Every Output node is also a run target: the toolbar's Run menu lists one entry per Output, and Export app turns each output key into an endpoint.

| Input | Type | Required | Description |
|---|---|---|---|
| `value` | Any | yes |  |

- **Control branches:** `done`
- **Permissions:** none
- **Execution policy:** timeout 30s, max attempts 1, idempotent

| Setting | Type | Default | Description |
|---|---|---|---|
| `key` | string | `output` | Field name in the run's output payload. |

## Code

`agenticmind.core.code` · version 1.0.0

Runs Python or JavaScript in a sandbox (Docker by default) on the connected value.

**Typical use.** Runs Python or JavaScript in the sandbox (Docker by default). The connected value arrives as `inputs`; in Python set `result` or define `main(inputs)`, in JavaScript `return` the value. Use it for data reshaping, statistics or anything a template cannot express.

| Input | Type | Required | Description |
|---|---|---|---|
| `inputs` | Any | no | Available to the code as ``inputs`` |

| Output | Type | Description |
|---|---|---|
| `result` | Any | The value the code returned |
| `stdout` | String | What the code printed |
| `error` | JSON | &#123;type, message, traceback&#125; or null |
| `report` | JSON | Backend, duration, exit code, notes |

- **Control branches:** `done`
- **Permissions:** `subprocess`
- **Execution policy:** timeout 900s, max attempts 1, not idempotent

| Setting | Type | Default | Description |
|---|---|---|---|
| `language` | `python` · `javascript` | `python` | Language |
| `code` | string | see below | Python: set ``result`` (or define main(inputs)). JavaScript: ``return`` the value. The connected value is ``inputs``. |
| `timeout_seconds` | number | `30` | Capped by the server's limit. |
| `memory_mb` | integer | `256` | Memory Mb |
| `network` | boolean | `false` | Ask for network access (only if the server allows it). |
| `on_error` | `fail` · `output` | `fail` | fail: an exception fails the node. output: return it in ``error``. |

<CodeBlock language="text" filename="Default code">

```
# `inputs` holds the connected value. Set `result` to a JSON value.
numbers = inputs or [3, 1, 4, 1, 5, 9]
result = {"count": len(numbers), "mean": sum(numbers) / len(numbers), "max": max(numbers)}

```

</CodeBlock>

## Collect

`agenticmind.core.collect` · version 1.0.0

Joins several branches into one list (explicit join; order follows edge IDs).

**Typical use.** Gathers values from several branches into one list. The order follows edge IDs, never completion order, so runs are deterministic.

| Input | Type | Required | Description |
|---|---|---|---|
| `items` | Any (many) | yes |  |

| Output | Type | Description |
|---|---|---|
| `items` | JSON |  |

- **Control branches:** `done`
- **Permissions:** none
- **Execution policy:** timeout 30s, max attempts 1, idempotent

*No configuration.*

## JSON Select

`agenticmind.core.json_select` · version 1.0.0

Selects a value inside a JSON document.

**Typical use.** Pulls one value out of a JSON document with a dotted path, for example `result.citations.0` or `user.addresses.0.city`.

| Input | Type | Required | Description |
|---|---|---|---|
| `data` | JSON | yes |  |

| Output | Type | Description |
|---|---|---|
| `value` | JSON |  |

- **Control branches:** `done`
- **Permissions:** none
- **Execution policy:** timeout 30s, max attempts 1, idempotent

| Setting | Type | Default | Description |
|---|---|---|---|
| `path` | string |  | Dotted path, e.g. ``user.addresses.0.city``. Empty = whole value. |
| `required` | boolean | `true` | Fail if the path does not exist (otherwise null). |

## Text Template

`agenticmind.core.text_template` · version 1.0.0

Renders a text template with &#123;&#123; placeholders &#125;&#125;.

**Typical use.** Builds prompts and messages. `{{ text }}` is the text input; `{{ name }}` or `{{ a.b }}` read fields of the `variables` JSON input. With `strict` on, a missing placeholder fails the node with `TEMPLATE_MISSING_VARIABLE`.

| Input | Type | Required | Description |
|---|---|---|---|
| `text` | String | no | Available as &#123;&#123; text &#125;&#125; |
| `variables` | JSON | no | Object of named values |

| Output | Type | Description |
|---|---|---|
| `text` | String |  |

- **Control branches:** `done`
- **Permissions:** none
- **Execution policy:** timeout 30s, max attempts 1, idempotent

| Setting | Type | Default | Description |
|---|---|---|---|
| `template` | string | `Hello, {{ text }}!` | Use &#123;&#123; text &#125;&#125; for the text input and &#123;&#123; name &#125;&#125; / &#123;&#123; a.b &#125;&#125; for fields of ``variables``. |
| `strict` | boolean | `true` | Fail when a placeholder cannot be resolved (otherwise it renders empty). |

## Text Transform

`agenticmind.core.text_transform` · version 1.0.0

Applies a simple text operation.

**Typical use.** Small deterministic text operations: uppercase, lowercase, trim, title case or slugify.

| Input | Type | Required | Description |
|---|---|---|---|
| `text` | String | yes |  |

| Output | Type | Description |
|---|---|---|
| `text` | String |  |

- **Control branches:** `done`
- **Permissions:** none
- **Execution policy:** timeout 30s, max attempts 1, idempotent

| Setting | Type | Default | Description |
|---|---|---|---|
| `operation` | `uppercase` · `lowercase` · `trim` · `title` · `slugify` | `uppercase` | Operation |
