FlowTruxFlowTrux/Docs
Docsworkflows

Execution

How FlowTrux workflows execute, handle errors, and store results.

When a workflow runs, the execution engine traverses the node graph, executes each node in order, and stores the results so downstream nodes can reference them.

Execution Flow

BFS Traversal

The engine starts at the Trigger node and performs a breadth-first traversal of the connected nodes. Each node executes only after all of its upstream dependencies have completed.

  1. The Trigger node fires and its data is stored in the StateContext.
  2. The engine identifies all nodes directly connected from the Trigger.
  3. Each ready node executes and stores its output.
  4. The engine advances to the next layer of nodes.
  5. This continues until all reachable nodes have executed or an error halts a branch.

StateContext

The StateContext is the runtime data store for a single execution. Every node writes its output to the StateContext upon completion. Downstream nodes read from it using template variables.

{{steps.nodeId.output.field}}

The StateContext holds:

  • Trigger data -- the initial input that started the workflow
  • Node outputs -- results keyed by node ID
  • Global context -- workspace-scoped persistent key-value pairs
  • Loop state -- current item and index during loop iteration

Error Handling

When a node fails during execution:

  • That node is marked as failed with an error message.
  • The branch downstream of the failed node stops executing.
  • Other independent branches continue to execute normally.

This means a failure in one part of the workflow does not necessarily prevent the rest from completing. Parallel branches are isolated from each other's errors.

Cancellation

Running workflows can be stopped using the Stop button in the execution panel. Cancellation halts the current node and prevents any remaining nodes from executing.

Execution History

Every workflow run is recorded as an Execution with the following information:

  • Status -- whether the execution succeeded, failed, or was cancelled
  • Duration -- total execution time
  • Node logs -- per-node results including output data, duration, and error messages

Viewing History

Open the execution panel in the workflow editor to see past runs. Each execution can be expanded to inspect individual node logs and outputs.

Deleting Executions

You can delete individual executions or clear all execution history for a workflow. Execution retention may be limited by the organization's plan (executionHistoryDays setting).

GlobalContext

GlobalContext is a persistent key-value store scoped to the current workspace. Unlike the StateContext which exists only for a single execution, GlobalContext values persist across runs.

Reading

Access values in any template field:

{{global.apiEndpoint}}

Use Cases

  • Store configuration values shared across workflows (API endpoints, default parameters)
  • Maintain state between scheduled runs (last processed ID, counters)
  • Share data between different workflows in the same workspace

GlobalContext entries can be managed through the UI or set programmatically during workflow execution.

Streaming Execution

Workflows can be executed with server-sent events (SSE) streaming via the endpoint:

POST /api/workflows/[id]/execute/stream

In streaming mode, the client receives real-time updates as each node starts and completes, rather than waiting for the entire workflow to finish.