Principle:Langgenius Dify Application Creation
| Knowledge Sources | Domains | Last Updated |
|---|---|---|
| Dify | LLM_Applications, Frontend, API | 2026-02-12 00:00 GMT |
Overview
Description
Application Creation is the foundational step in the Dify platform workflow. Every LLM-powered application begins with this principle: a user defines a new application by specifying its name, mode, and optional metadata such as icon and description. The application mode determines the runtime behavior and available configuration surfaces for the rest of the application lifecycle.
Dify supports five distinct application modes, each serving a different class of LLM interaction pattern:
- completion -- A single-turn text generation application that accepts input and produces a one-shot response.
- workflow -- A multi-step orchestration pipeline where nodes are connected in a directed acyclic graph.
- chat -- A conversational application with memory, supporting multi-turn dialogue.
- advanced-chat -- An enhanced chat application that combines conversational memory with workflow orchestration capabilities.
- agent-chat -- An autonomous agent application that can invoke external tools and reason over multiple steps to accomplish tasks.
The platform provides three distinct creation pathways:
- Direct Creation -- The primary method where the user fills in a creation form specifying the app name, mode, icon, and optional model configuration. This calls the
createAppservice function. - Duplication (Copy) -- Cloning an existing application via
copyApp, which preserves the source application's configuration while allowing the user to customize the name and icon of the new copy. - DSL Import -- Importing an application from a YAML-based Domain-Specific Language definition via
importDSL, enabling portability and version-controlled application definitions.
The chosen mode is immutable after creation (though the platform offers a conversion endpoint for migrating basic apps to workflow-based apps via switchApp). Therefore, selecting the correct mode at creation time is a critical architectural decision.
Usage
Application creation is used whenever a developer or team needs to:
- Bootstrap a new LLM-powered application on the Dify platform.
- Duplicate an existing, proven application configuration for rapid iteration.
- Import a pre-built application definition from a YAML DSL file or URL.
- Establish the foundational mode that constrains all subsequent configuration (model selection, prompt design, knowledge base attachment, and publishing).
Theoretical Basis
The Application Creation principle follows the Factory Pattern in software design. The createApp function acts as a factory that accepts a discriminated union of parameters (where mode is the discriminant) and produces a fully initialized application entity. The mode enum (AppModeEnum) serves as a type-level constraint that propagates through the entire configuration pipeline, ensuring that downstream operations (model config, prompt templates, debug testing) are compatible with the chosen application type.
This principle also embodies the Convention over Configuration philosophy: by selecting a mode upfront, the platform can pre-populate sensible defaults for model parameters, prompt templates, and feature toggles, reducing the cognitive load on the developer.
From an architectural perspective, the separation of creation pathways (direct, copy, import) follows the Open/Closed Principle: the system is open for extension through new import formats or creation methods without modifying the core application entity structure.