## Execution and Flow Control

The _Execution and Flow Control_ functions let you manage how a Flow runs. You can stop or restart a Flow, track node executions, run other Flows, and set which Node executes next.

## [`executeFlow`](https://docs.cognigy.com/ai/for-developers/function-reference/execution-control/executeFlow)

**Syntax:** `executeFlow(config)` Executes a target Flow starting from a specified Entrypoint Node.

## [`setNextNode`](https://docs.cognigy.com/ai/for-developers/function-reference/execution-control/setNextNode)

**Syntax:** `setNextNode(nodeId, flowId)` Sets a custom Node with the given `nodeId` to be executed immediately after the current one.

## [`resetNextNodes`](https://docs.cognigy.com/ai/for-developers/function-reference/execution-control/resetNextNodes)

**Syntax:** `resetNextNodes()` Clears any active overrides for the next Node in the Flow.

## [`addConditionalEntrypoint`](https://docs.cognigy.com/ai/for-developers/function-reference/execution-control/addConditionalEntrypoint)

**Syntax:** `addConditionalEntrypoint(params)` Adds a conditional Entrypoint for the current conversation. This condition is used by the Optional Question Node.

## _(Deprecated)_ [think](https://docs.cognigy.com/ai/for-developers/function-reference/execution-control/think)

**Syntax:** `think(text, data)` Restarts Flow execution with a simulated input.

## [thinkV2](https://docs.cognigy.com/ai/for-developers/function-reference/execution-control/thinkV2)

**Syntax:** `thinkV2(text, data)` Restarts Flow execution with a simulated input using the provided text and data.

## [`stopExecution`](https://docs.cognigy.com/ai/for-developers/function-reference/execution-control/stopExecution)

**Syntax:** `stopExecution()` Stops processing the current input after this Node.

## [`getExecutionAmount`](https://docs.cognigy.com/ai/for-developers/function-reference/execution-control/getExecutionAmount)

**Syntax:** `getExecutionAmount(nodeId)` Retrieves the number of times a Node with the given `nodeId` has been executed during this conversation.

## [`setExecutionAmount`](https://docs.cognigy.com/ai/for-developers/function-reference/execution-control/setExecutionAmount)

**Syntax:** `setExecutionAmount(nodeId, value)` Returns the number of times the Node with the given `nodeId` has been executed in the current conversation.

## [`resetExecutionAmount`](https://docs.cognigy.com/ai/for-developers/function-reference/execution-control/resetExecutionAmount)

**Syntax:** `resetExecutionAmount(nodeId)` Resets the number of executions to 0 for the Node with the given `nodeId`.

Last modified on April 21, 2026
