FastGPTFastGPT

Variable Update

Use the FastGPT Workflow Variable Update node to mutate global variables and intermediate state across workflow steps and loops.

Features

  • Can be added multiple times
  • Has external inputs
  • Trigger-based execution
  • Manual configuration

Features — interface example

Function

  • A single node can update global variables and upstream node outputs together. This configuration applies numeric addition, boolean inversion, array append, and question replacement.

Function — interface example

Function — interface example

  • Numeric operators and the resulting values are shown below: the count becomes 3, the switch becomes true, and second is appended to the array.

Function — interface example

Function — interface example

Use Cases

Common scenarios include:

  • Assign a value to an "Internal Variable" type global variable, so the global variable doesn't require user input
  • Update a workflow node's output upstream of the Variable Update node, so downstream nodes use the new value

Configuration, order, and boundaries

For each update, select a global variable or node output as the target, then choose a manual value or upstream reference. Manual operations depend on type: numbers support assignment and arithmetic, booleans support setting and negation, and arrays support replacement, appending one item, and clearing. Reference mode assigns the complete referenced value.

Updates within one node run in order; later updates can read earlier changes. The template has no separate data outputs. Downstream nodes reference the updated target, and execution details record update results.

Example: record processing status

  1. Create a string global variable named status with the Internal Variable type.
  2. Connect Start → Variable Update → Assigned Reply.
  3. Select status as the update target, choose manual input, and enter ready.
  4. Reference global variable status in Assigned Reply. Debug and expect ready, with the same value in execution details.

For an unchanged value, inspect target references and types. Parallel tasks writing the same target produce completion-order-dependent values; use the parallel node's aggregate output for deterministic results. See Loop and Parallel Run for container writeback behavior.

Edit on GitHub

Last updated

On this page

Put your business knowledge to work with AI

Import company documents and build accurate, reliable, traceable AI answers.