Migrate from Dify to LangStudio

Updated at:

Migrate a Dify application to LangStudio in two stages. The migration script converts the application structure. You then manually configure environment dependencies such as model connections and knowledge bases, and run integration tests.

How it works

The migration has two core stages: automated conversion and manual configuration.

  1. Automated conversion: The migration script reads the Domain Specific Language (DSL) file of the Dify application and converts it to the LangStudio application flow format. This stage completes the initial migration of the node layout and basic connections.

  2. Manual configuration: The two platforms differ in their environment dependencies (such as LLM connections, knowledge bases, and MCP tools) and in how some nodes are implemented. Recreate these dependencies in LangStudio based on the original Dify application, then adjust and test the affected nodes so that the application is fully functional and runs correctly.

Step 1: Automated conversion

Import the converted file into LangStudio to create an initial application flow structure.

  1. Export your application's DSL file from Dify. The file is usually in .yml format. This topic uses a Dify application flow built from the QuestionClassifier+Knowledge+Chatbot template as an example. Download its DSL file to follow along: QuestionClassifier+Knowledge+Chatbot.yml.

  2. Download the migration script dify_to_langstudio.py and run the following command to convert the DSL file into a LangStudio application flow.

    python dify_to_langstudio.py /path/to/dify_dsl.yml /path/to/output_dir

    Where:

    • /path/to/dify_dsl.yml: The path to the DSL file.

    • /path/to/output_dir: The output directory that you specify. After the command runs successfully, the langstudio_flow.zip file appears in this directory.

  3. Log on to LangStudio and open the page to create an application flow. Select Import from OSS and specify the path to the application flow. Then upload the langstudio_flow.zip file that you generated, select it, and enter a name to create the application flow.

  1. In this application flow, the Start node (with the chat_history, question, file1, and file2 input parameters) connects to a Question Classifier node that uses the Qwen3-8B model. The Question Classifier node splits the application flow into three branches based on intent. Two branches, Question related to after sales and Questions about how to use products, each pass through a Knowledge Retrieval node and an LLM node before they reach their own Answer node. The third branch, Other questions, connects directly to an Answer node for output.

Step 2: Manual configuration

After the automated conversion, check and configure each node in the application flow.

The following table lists how Dify nodes map to LangStudio nodes. A dash (-) in the LangStudio node column means no equivalent is specified.

Dify node

LangStudio node

Migration approach

Start node

Start node

Manual configuration

Question Classifier

Intent Recognition

Manual configuration

Knowledge Retrieval

Knowledge Base Retrieval

Manual configuration

LLM

Large Language Model (LLM)

Manual configuration

Answer

Direct Output

Manual configuration: copy the prompt template

None (Dify Chatflow has no End node)

End node

Manual configuration

Code execution

Python

Manual configuration

Agent

Agent

Manual configuration

Iteration

Loop

Manual configuration

Document Extractor

Document Parsing

Manual configuration

If-Else

Conditional Branch

Manual configuration

Loop, Loop End, Variable Assigner, Variable Aggregator, and Answer

-

Automated conversion

Template Transform, Parameter Extractor, HTTP Request, and List Operator

-

Not yet supported

Other third-party tools

-

Not supported

Start node

LangStudio equivalent: Start node.

Migrate the Dify system variables as follows:

  • sys.files: LangStudio supports only the single-file type. To use a file list (Array[File]), create multiple variables of the single-file type.

  • sys.query: Converted directly to the input field named question.

  • sys.dialogue_count/sys.conversation_id

    sys.user_id/sys.app_id/sys.workflow_id/sys.workflow_run_id: Implement these by using session variables in the Global Configuration of the LangStudio application flow.

Question Classifier

LangStudio equivalent: Intent Recognition.

  • Model: Equivalent to Model settings. Create the same LLM connection in LangStudio as in Dify (see Connection configuration), and then select the connection on the LLM node.

  • Classification: Equivalent to Multi-intent Configuration. Make sure the classifications match those in the original Dify application.

  • Instruction: Equivalent to the Additional Prompt of the Intent Recognition node.

In the Question Classifier configuration panel in Dify, also select the corresponding question variable from the User Input drop-down list.

Knowledge Retrieval

LangStudio equivalent: Knowledge Base Retrieval.

  • Recreate a knowledge base by using the tools that LangStudio provides, and then configure it in the node. For more information, see Manage knowledge bases.

  • Query variable: Equivalent to the Retrieval Keyword of the Knowledge Base Retrieval node.

The Knowledge Base Retrieval configuration panel also includes these parameters: Knowledge Base Index Name (select the knowledge base that you created), Top K (set to 3), Score Threshold, Retrieval Mode, and Metadata Filter parameters. The output variable is result (Array<Object>), which contains the content (String) and score (Number) fields.

LLM

LangStudio equivalent: Large Language Model (LLM).

  • Model: Create the same LLM connection in LangStudio as in Dify (see Connection configuration), and then select the connection on the node.

  • Prompt: To use the output variable of an upstream node in the prompt of a LangStudio LLM node, first define it as an input variable.

  • Retry on Failure: Dify supports a retry-on-failure strategy. LangStudio doesn't support this feature.

  • Vision: Equivalent to the Vision switch of the LLM node.

  • Memory: Equivalent to the Memory window switch of the LLM node (turn on History first).

  • Structured output: Equivalent to the output variable definition of the LLM node.

  • Output variable: A Dify LLM node returns the generated content and the model usage information. A LangStudio LLM node returns only the body of the model response.

In the Input Variable area of the Dify LLM node, create a context variable that references the output of the upstream Knowledge Retrieval node. Then reference the variable in the USER prompt editor by using {{context}}.

Answer

LangStudio equivalent: Direct Output.

In the Dify Answer node configuration panel, open the output template area and copy the corresponding prompt into the template. To reference the output of an upstream node (such as {{LLM/output}}), first delete the existing content and then enter / to trigger variable selection again.

End

LangStudio equivalent: End node.

A Dify Chatflow doesn't support an end node, but a LangStudio application flow must have one. Connect the logical endpoints of your application flow to the End node to explicitly mark the end of execution. On the application flow canvas, the End node is on the right side. It receives the output of the Answer nodes in each conditional branch and marks the end of the entire application flow.

Code execution

LangStudio equivalent: Python.

Copy the Python code from Dify to LangStudio, and then add the @tool decorator and an output class definition.

  • Dify parses the Python input parameters automatically from the input variables. LangStudio works the opposite way. Define the inputs and outputs in the code first. At runtime, LangStudio automatically parses the code and generates the parameters.

  • LangStudio doesn't support Node.js.

Agent

LangStudio equivalent: Agent.

  • Agent strategy: Dify supports multiple strategies. LangStudio supports only functioncall and react.

  • Model: Create the same LLM connection in LangStudio as in Dify (see Connection configuration), and then select the connection on the LLM node.

  • Tool list: Dify supports many built-in tools and MCP. LangStudio supports only MCP. Create an MCP connection in LangStudio first.

  • Instruction/Query: Equivalent to the prompt of the LangStudio Agent node.

  • Memory: Equivalent to the Memory switch of the Agent node.

Iteration

LangStudio equivalent: Loop.

Configure an additional index variable in the Loop node to traverse a List object. This reproduces the logic of the Iteration node.

Document Extractor

LangStudio equivalent: Document Parsing.

  • In the Document Parsing node, select Document.

  • Model: Create an OpenSearch connection in LangStudio to parse documents.

If-Else

LangStudio equivalent: Conditional Branch.

Configure the same conditions in LangStudio as in Dify.

Other node mappings

  • Loop, Loop End, Variable Assigner, Variable Aggregator, and Answer: converted automatically.

  • Template Transform, Parameter Extractor, HTTP Request, and List Operator: not yet supported.

  • Other third-party tools: not supported. To use MCP in LangStudio, see Build a ChatBI agent with LangStudio and Hologres.

Other feature mappings

Speech-to-text and text-to-speech

  • Speech-to-text: Add a Speech Recognition node in LangStudio.

  • Text-to-speech: Configure this in the Global Configuration panel.

    Click Global Configuration in the top navigation bar. In the panel that opens, find the Text-to-Speech Settings section, and then turn the feature on or off.

File upload switch

The Dify Start node has a default sys.files variable that accepts a list of uploaded files. In LangStudio, predefine fields of the File type. To upload multiple documents, define multiple fields of the File type.

Step 3: Integration testing

After you configure all the nodes, run comprehensive integration tests to make sure the application works reliably.

  • End-to-end debugging: Connect all the nodes and check the logs to troubleshoot issues such as undefined variables and data that isn't passed as expected.

  • Coverage testing: Simulate real user sessions, exceptions, and retry scenarios to make sure the application is robust.

Click Run in the upper-right corner of the page to debug the application flow. The run panel appears on the right side of the page. Enter test content in the chat input box at the bottom of the panel, and then click Send to run integration tests on the application flow. If a configuration is incorrect, an error message appears. Fix the configuration as prompted.

Recommendations for production

  • Migrate a simple application first: If this is your first migration, choose an application with a simple structure to practice on and get familiar with the full process.

  • Run thorough integration tests: Automated conversion is only the first step. For example, Dify and LangStudio handle file uploads and error retry mechanisms differently. Before you go live, run complete end-to-end tests. Pay close attention to variable passing, node logic, and data formats to make sure they work as expected.

FAQ

Q: Why can't the migration script automate 100% of the work?

Dify and LangStudio differ in their environment dependencies (such as API keys and database connections) and in some core features (such as knowledge base implementation and Python code standards). The migration script converts the platform-independent application structure. Rebuild the environment-specific configuration manually in the target environment to make sure the application is secure and correct.

Q: What do I do if LangStudio doesn't support a Dify node?

See the node mapping table in Step 2: Manual configuration. For an unsupported node such as HTTP Request, you can usually write a small amount of code in the LangStudio Python node to reproduce its function. Alternatively, combine other nodes to implement the same business logic.

Q: The Python code that I copied from Dify throws an error in LangStudio. How do I fix it?

The LangStudio Python node has specific code standards. For example, functions must use the @tool decorator, and you must explicitly define the output data structure. Adapt your code by following the migration notes in Code execution.