Documentation
Docs Build

Variables & Logic

Use dynamic values, conditions, paths, and tool inputs to build workflows that adapt safely at runtime.

Intermediate 7 min Build
Browse documentation
Build Intermediate 7 min

Advanced Logic & Variables

Take your workflows to the next level by using dynamic variables. This allows nodes to "talk" to each other and share information across the entire flow.


🔗 The Variable Syntax

You can inject data into almost any text field (Prompts, URLs, Headers, etc.) using the double-curly-bracket syntax: {{variable.path}}.

1. The input variable

Refers to the data passed directly into the current node from the previous one.

  • Example: Translate this: {{input}}
  • Nested Data: If the input is a complex object, use dots: {{input.user.name}}.

2. The nodes variable

Allows you to grab data from any previous node in the workflow by its ID.

  • Syntax: {{nodes.NODE_ID.result}}
  • Example: Summarize the results from the scraper: {{nodes.node_123.result.text}}
  • Tip: You can find a node's ID by clicking on it in the editor.

3. The memory variable

Refers to global data stored for the entire workflow execution.

  • Syntax: {{memory.key}}
  • Example: Hello {{memory.user_name}}, welcome back.
  • Sessions: Use a Memory node with a custom Session ID to isolate memory between runs.

4. The context variable

Provides agent-facing context assembled from Context Memory blocks and Agent summaries.

  • Syntax: {{context.summary.latest}}, {{context.cursor.latest}}, {{context.blocks}}
  • Example: Use this brief: {{context.summary.latest}}
  • Tip: Context blocks also store to memory under context.<title> for direct access.

🧩 Path Traversing (Dot Notation)

If a node returns a list of items or a complex object, you can "drill down" to the specific piece of data you need:

  • Array Items: {{input.items[0].title}} (Grabs the title of the first item).
  • Deep Nesting: {{nodes.api_call.result.data.user.profile.email}}.

⚡ Logical Operators (Switch/If Node)

The Switch and If nodes use these variables to make decisions.

1. Variable: {{nodes.sentiment_agent.result}} 2. Condition: Equals 3. Value: Negative

  • Scenario: Only send an email if the AI Agent's sentiment analysis is "Negative".
  • Setup:

💻 Custom Code (JS/PHP)

For extreme flexibility, the Code node gives you full access to the input object.

  • JavaScript: return input.price * 1.25;
  • PHP: $result = $input['first_name'] . ' ' . $input['last_name'];

🧰 Tool Inputs & Overrides

Tool nodes can receive inputs in three ways:

  1. Upstream data (default): the previous node’s output.
  2. Tool Input panel (recommended for required fields): enter parameters like amount, bucket, or base_id.
  3. Manual override: paste raw text or JSON to force the tool input.

Example: Stripe

* {"amount": 2500, "currency": "usd"}

  • Set amount and currency in the Tool Input panel.
  • Or pass them from a previous Set node:

Tip: If a tool shows a “missing required inputs” warning, either fill the fields or ensure upstream data provides them.

Related Guides