Skip to main content
The context object is the central runtime state container for every workflow execution. It stores inputs, intermediate data, node-level status, final outputs, and metadata needed for debugging and session rehydration.

Top-Level Structure

Every workflow execution has a single context object with three top-level categories:
CategoryKey ExamplesDescription
Run MetadatastartDate, status, flowType, appId, versionId, cfProcessIdIdentifiers and timestamps for the workflow instance.
Execution Statesteps, branch, activeSteps, statusProgress and outcome data for each node.
Environment & Configenv, agentTimeout, asyncExecDetailsRuntime and environment parameters.

The steps Object

The steps object is a map that holds the execution state of every node in the workflow, indexed by node name.
"steps": {
  "NodeNameA": { ... },
  "NodeNameB": { ... },
  "NodeNameC": { ... }
}
Each node entry contains:
FieldDescription
inputData received by the node at execution time.
outputResult produced by the node — model outputs, processed data, or API responses.
statusCode / isSuccessfulWhether execution succeeded, failed, or was skipped.
logsOptional log text or debug messages.
executionTime, totalTime, pausedAt, resumedAtNode-level timing data for performance analysis.
reqObj / resObjFor AI nodes, the raw request and response envelopes.
metadataNode-specific information such as schema references, task IDs, or external job handles.
Example node structure:
"steps": {
  "ExampleNode": {
    "input": {
      "parameters": { "param1": "value1" },
      "contextRefs": { "previousNodeOutput": "..." }
    },
    "output": {
      "result": "some value",
      "summary": "optional explanation",
      "structuredData": { "key": "value" }
    },
    "statusCode": 200,
    "isSuccessful": true,
    "logs": "Node executed successfully",
    "executionTime": "1250ms",
    "metadata": {
      "model": "gpt-5",
      "nodeType": "LLM",
      "dependencies": ["SchemaRetriever", "Sanitizer"]
    }
  }
}

How steps evolves during execution

The platform populates steps as the workflow runs:
  1. Initialization — The steps object starts empty.
  2. Node execution — An entry is created for each node as it runs.
  3. Completion — Outputs and timing data are appended.
  4. Error handling — Logs and status are updated; branch reflects failures.

Common Node Types

Node TypeTypical FieldsPurpose
Input/Startuser_query, metadataCaptures initial requests.
APIbody, statusCode, totalTimeFetches external data.
AIreqObj, resObj, modelElapsedTimeRecords prompt and response data.

Cross-Node Referencing

Nodes reference each other’s data using the {{ }} syntax. Values resolve at runtime. Example: Pass the schema output from one node as input to the next.
"steps": {
  "SchemaRetriever": {
    "output": { "schema": [ ... ] }
  },
  "QueryGenerator": {
    "input": {
      "schema": "{{steps.SchemaRetriever.output.schema}}"
    }
  }
}

Supported reference patterns

{{context.appId}}
{{context.steps.QueryGenerator.output.sql_query}}
{{context.schema[0].column_name}}
{{context.steps.Start.variable_name}}
  • context refers to the full context object.
  • steps provides scoped access to individual node data.
  • References work in input fields, API node parameters, LLM prompts, and conditions.

Evaluation behavior

  • Lazy evaluation — Values resolve immediately before the node executes.
  • Missing keys — If a referenced key doesn’t exist, the expression resolves to null or an empty string in string contexts.
  • Circular references — Automatically detected and blocked.

Extending Context with Script Nodes

Use Script Nodes to add or modify context keys dynamically. Any key you add is accessible in later nodes using {{context.<key>}}.
// Add a simple key-value pair
context.newKey = "Hello World";

// Store structured data
context.customData = {
  runId: context.cfProcessId,
  stage: "validation",
  timestamp: new Date().toISOString()
};

// Access it in later nodes
console.log(context.customData.stage);

Guidelines

  • Use camelCase naming — for example, customerInfo, retryCounter, tempResults.
  • Don’t override system-reserved keys: steps, branch, status, dbquery.
  • Keep data lightweight — avoid storing large arrays or raw API responses.

Loop Node Context

When a Loop Node executes, it creates its own context object that tracks iteration progress and results. This object is accessible throughout the workflow.

Structure

{
  "loopId": "string",
  "startTime": "timestamp",
  "iterationCount": "number",
  "inputs": ["array of input values"],
  "outputArray": ["array of iteration results"],
  "totalCount": "number",
  "childNodesExecuted": "number"
}
FieldTypeDescription
loopIdStringUnique identifier for the loop node, matching the node ID in your flow.
startTimeTimestampWhen the loop started executing.
iterationCountNumberNumber of iterations completed so far.
inputsArrayThe original list of items the loop processes.
outputArrayArray of ObjectsResults from each iteration, in execution order.
totalCountNumberTotal number of items to process (same as inputs length).
childNodesExecutedNumberTotal count of child nodes that ran across all iterations.

Accessing loop data

Inside the loop — Use iteration-scoped variables:
VariableDescription
{{context.currentItem}}The item being processed in the current iteration.
{{context.currentIndex}}Zero-based index of the current item.
{{context.currentOutput[x]}}Output from a specific previous iteration.
Outside the loop — Access results using the loop node’s ID:
VariableDescription
{{context.steps.Loop0001.output}}The complete array of all iteration results.
{{context.steps.Loop0001.output[0]}}The result from a specific iteration.
Example: Processing a list of email addresses.
{
  "loopId": "Add2DB_0",
  "startTime": "2025-11-12T09:23:05.306Z",
  "iterationCount": 2,
  "inputs": ["user1@example.com", "user2@example.com"],
  "outputArray": [
    { "output": { "success": "user1@example.com added to the Employee Database" } },
    { "output": { "success": "user2@example.com added to the Employee Database" } }
  ],
  "totalCount": 2,
  "childNodesExecuted": 10
}

Best Practices

  • Use consistent node naming: Names like QueryGenerator or DataCleaner make context references traceable and readable.
  • Mask sensitive data: Don’t write credentials or PII directly to the context object.
  • Prefer declarative references: Use {{context.<key>}} syntax wherever possible. Reserve Script Nodes for computed or dynamic values.
  • Keep context data lightweight: Avoid storing large arrays or raw API payloads.