Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Langgenius Dify Input Variable Definition

From Leeroopedia
Revision as of 17:22, 16 February 2026 by Admin (talk | contribs) (Auto-imported from principles/Langgenius_Dify_Input_Variable_Definition.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources Dify
Domains Workflow, DAG, Frontend
Last Updated 2026-02-12 00:00 GMT

Overview

Description

Input Variable Definition is the principle governing how data enters and flows between nodes in a Dify workflow. Every workflow begins with a Start node that declares its expected inputs, and every downstream node references upstream data through a structured type system. This principle encompasses three interconnected concepts:

  1. InputVarType: An enumeration of the UI form-field types that a workflow's Start node can accept from end users. These types define the user-facing input surface and include text fields, dropdowns, numbers, URLs, file uploads, JSON objects, and checkboxes.
  2. ValueSelector: A path-based reference mechanism represented as a string array ([nodeId, key]) that allows any node to reference a specific output variable from any upstream node. This is the backbone of inter-node data wiring.
  3. VarType: An enumeration of the runtime data types that variables can carry within the workflow engine, including primitives (string, number, boolean), complex types (object, file), and typed arrays (array[string], array[number], etc.).

The separation of input types (what users see) from variable types (what the engine processes) allows the platform to maintain a clean boundary between presentation and execution.

Usage

When defining inputs for a workflow:

  • Use InputVarType to configure the Start node's form fields, determining what UI elements are shown to end users.
  • Use ValueSelector (a string[] of format [nodeId, variableKey]) to wire node outputs as inputs to downstream nodes.
  • Use VarType to declare and validate the runtime data types of variables as they flow through the DAG.
  • The Variable type combines these concepts: it carries a variable name, a value_selector for wiring, and an optional value_type for type checking.

Theoretical Basis

This principle is grounded in:

  • Strongly Typed Data Flow: Similar to typed dataflow languages (e.g., LabVIEW, Unreal Blueprints), each connection between nodes carries a declared type. The VarType enum ensures that connections are type-compatible at design time, preventing runtime errors from type mismatches.
  • Path-Based Variable Resolution: The ValueSelector pattern ([nodeId, key]) mirrors JSON Pointer or XPath semantics, providing a deterministic way to resolve variable references across a graph without ambient scoping. This avoids the ambiguity of name-based resolution in complex DAGs with potential naming collisions.
  • Presentation-Logic Separation: InputVarType governs the UI layer (form rendering), while VarType governs the engine layer (runtime processing). This separation follows the Model-View pattern, allowing the same runtime type (string) to be presented as different input widgets (text-input, paragraph, url, select).

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment