System variables
When an execution starts, Brain Studio automatically injects system variables into the context. You can access them in all nodes without needing to declare them.executionId
Each workflow execution receives a unique identifier calledexecutionId. Brain Studio generates it automatically when the flow starts and it remains constant throughout the entire execution, including branches between Skills and calls to Tools.
The
executionId is read-only. Brain Studio generates it automatically at the start of each execution; you do not need to create or modify it.What it’s used for
TheexecutionId lets you uniquely identify each execution of your flow. This is useful when you need to:
- Connect external systems: Send the ID to your backend so it can track or correlate the conversation with your internal records.
- Resume paused executions: When an AI Agent pauses waiting for an external response (for example, an approval), the external system needs the
executionIdto resume the correct execution. - Auditing and traceability: Record in your databases which execution generated each action, making it easier to track and troubleshoot.
Example: Sending to an external API
Suppose your flow queries an external service and you need that service to know which execution to respond to. In an API node, you can include theexecutionId in the request body:
callbackExecutionId and uses it to send the response back to the correct execution.
Example: Resuming a paused AI Agent
When you configure an AI Agent with external resumption pause, the resumption payload requires theexecutionId to identify which execution to continue:
Example: Saving to Datum for auditing
In a Datum node, you can save theexecutionId along with the operation data to have full traceability:
executionId in your database and see exactly which steps were executed.
In code nodes
Inside a Code node, you access theexecutionId just like any other context variable:
Custom variables
In addition to system variables, you can create your own context variables using Variable nodes, Code nodes, or any node that saves data to context (such as responses from interactive nodes).Reading variables
Inside any node you can access the context with the syntax{{$context.variableName}}. For example, if the variables in context are:
{{$context.name}}showsJohn.{{$context.lastOrder.status}}showson the way.
Context in code nodes
In code nodes, you use context methods differently:$context.get(key, [defaultValue])— Gets a value from context$context.set(key, value)— Saves or updates a value in context$context.getHttpResponse(key)— Gets the full response from an HTTP node$context.getHttpRequest(key)— Gets the request sent by an HTTP node
Context vs Memory
| Feature | Context ($context) | Memory ($memory) |
|---|---|---|
| Duration | Current execution only | Up to 24 hours |
| Scope | All nodes in the flow | All flows for the user |
| Typical use | Temporary conversation data | Data that persists between conversations |
| System variables | executionId (injected automatically) | None |