Skip to main content
Application Development

Workflow application

A workflow breaks down complex tasks into ordered steps to reduce system complexity. In Alibaba Cloud Model Studio, workflows let you combine nodes, such as large models, APIs, and Function Compute, to reduce coding costs.

Application

Why use a workflow application

A workflow breaks down complex tasks into a sequence of steps to reduce system complexity. Creating a workflow application on Model Studio lets you define the execution order, assign responsibilities, and specify dependencies between steps to automate and optimize the process. Common use cases for workflow applications include:
  • Travel planning: You can use a workflow plugin to select parameters, such as a destination, and automatically generate a travel plan that includes flights, accommodations, and attraction recommendations.
  • Report analysis: For complex datasets, you can combine data processing, analysis, and visualization plugins to generate structured, formatted analysis reports.
  • Customer support: You can use automated workflows to handle customer inquiries, including issue classification, to improve response speed and accuracy.
  • Content creation: You can generate content such as articles and marketing copy. Provide a topic and requirements, and the system automatically generates a draft.
  • Education and training: You can use a workflow to design personalized learning plans with progress tracking and assessments, enabling self-paced learning for students.
  • Medical consultation: Based on patient-entered symptoms, a workflow can combine multiple analytical tools to generate a preliminary assessment or recommend relevant tests to assist doctors with further diagnosis.

Examples

Example 1: Detect scam messages

This example demonstrates how to create a workflow application to determine if a text message is a potential scam. The workflow uses a start node, a large model node, and an end node.
  1. Go to the App Management page. Click Create Application>Workflow Application, enter an App Name, and then click Create Now.
  1. Add a large model node to detect scam messages. Drag the LLM node from the left-side pane to the canvas and configure the following parameters in its configuration panel. Leave other parameters at their default values.
    1. Model Configuration: Select Qwen-Plus-latest.
    2. Prompts:
      Analyze the provided message to determine if it is a potential scam. Provide a definitive answer.
       Requirements: Carefully review the message content, focusing on keywords and typical scam patterns, such as requests for urgent transfers, providing personal information, or promising unrealistic benefits.
      Steps:
      1. Identify key elements in the message, including but not limited to the sender's identity, the request made, promised rewards, and any sense of urgency.
      2. Compare the message against the characteristics of known scams to check for similar tactics or language patterns.
      3. Evaluate the overall reasonableness of the message, considering whether the request aligns with standard procedures and common sense.
      4. If the message contains links or attachments, do not click or download them to avoid potential security risks, and warn the user about the dangers of such content.
      Output Format: Clearly state whether the message exhibits characteristics of a scam and briefly explain your reasoning. If a scam is suspected, provide suggestions or preventive measures to protect the user.
      
    3. User Prompt:
      Determine if the message "${sys.query}" is a potential scam.
      
    Close the panel and connect the Start node to the Large Model node.
p910525
  1. Connect the large model node to the end node. Then, click the end node and in its configuration panel's editor, enter / to insert the Large Model 1/result variable. Leave other parameters at their default values.
p910524
Configuration example:
image
  1. Click Test in the upper-right corner. Enter Your package has been at the pickup station for several days. Please come and collect it. and click image. After the workflow finishes running, view the output.
image
  1. Next, enter You have a message saying you've won 1 million. Please check it. and click image. After the workflow runs, view the output.
image

Example 2: Smart shopping assistant

This example shows how to create a smart shopping assistant using a workflow that helps users select mobile phones, TVs, and refrigerators. The workflow uses a start node, an intent classification node, large model nodes, and an end node.
  1. Go to the App Management page. Click Create Application>Workflow Application, enter an App Name, and then click Create Now.
  1. Drag the Intent Classification node from the left-side pane to the canvas and configure the following parameters in its configuration panel. Leave other parameters at their default values.
    • Input Variable: Select Built-in Variable > query.
    • Select Model: Select Qwen-Plus-latest.
    • Intent Classification: Click Add Intent and add the following three intents:
      • Buy TV
      • Buy mobile phone
      • Buy refrigerator
    • Memory: Enables the model to remember previous chat content during a conversation. Turn on the toggle image and select Custom Cache.
      Current Node Cache: The model remembers only the chat content within the current node.
      Custom Cache: The model remembers the conversation across the entire workflow.
    Close the panel and connect the Start node to the Intent Classification node.
p910523
  1. Drag a LLM node from the left-side pane to the canvas. In its configuration panel, configure the following parameters, leaving others at their default values. Then, close the panel and connect the Buy refrigerator output of the Intent Classification node to the Large Model node.
    • Model Configuration: Select Qwen-Plus-latest.
    • Prompts:
      You are a smart shopping assistant responsible for recommending refrigerators to customers.
      You must proactively ask the user for refrigerator parameters in the order listed in the [Refrigerator Parameter List] below. Ask for only one parameter at a time, and do not repeat questions for the same parameter.
      If the user provides a value for a parameter, continue to ask about the remaining parameters.
      If the user asks for the definition of a parameter, provide an explanation based on your professional knowledge, and then continue to ask which parameter value they prefer.
      If the user indicates they no longer wish to make a purchase, output: Thank you for visiting. We look forward to serving you next time.
      [Refrigerator Parameter List]
      1. Usage Scenario: [Home, Small commercial, Large commercial]
      2. Capacity: [200L, 300L, 400L, 500L]
      3. Energy Efficiency Rating: [Level 1, Level 2, Level 3]
      After all parameters from the [Refrigerator Parameter List] have been collected, ask: "Are you sure you want to purchase?" while also showing the parameters the customer has selected, for example: For small commercial use|300L|Level 1. Ask if they are sure about the refrigerator with these parameters. If the customer decides not to buy, ask which parameters they want to adjust.
      If the customer confirms the parameters meet their requirements, you must output in the following format:
      [Usage Scenario: Home, Capacity: 300L, Energy Efficiency Rating: Level 1]. Output only the content in this format and no other information.
      
    • User Prompt:
      User's question: ${sys.query}
      
    • Memory: Enables the model to remember previous chat content during a conversation. Turn on the toggle image and select Custom Cache.
p910522
  1. Drag a LLM node from the left-side pane to the canvas. In its configuration panel, configure the following parameters, leaving others at their default values. Then, close the panel and connect the Buy TV output of the Intent Classification node to the Large Model node.
    • Model Configuration: Select Qwen-Plus-latest.
    • Prompts:
      You are a smart shopping assistant responsible for recommending TVs to customers.
      You must proactively ask the user for TV parameters in the order listed in the [TV Parameter List] below. Ask for only one parameter at a time, and do not repeat questions for the same parameter.
      If the user provides a value for a parameter, continue to ask about the remaining parameters.
      If the user asks for the definition of a parameter, provide an explanation based on your professional knowledge, and then continue to ask which parameter value they prefer.
      If the user indicates they no longer wish to make a purchase, output: Thank you for visiting. We look forward to serving you next time.
      [TV Parameter List]
      1. Screen Size: [50-inch, 70-inch, 80-inch]
      2. Refresh Rate: [60Hz, 120Hz, 240Hz]
      3. Resolution: [1080P, 2K, 4K]
      After all parameters from the [TV Parameter List] have been collected, ask: "Are you sure you want to purchase?" while also showing the parameters the customer has selected, for example: 50-inch|120Hz|1080P. Ask if they are sure about the TV with these parameters. If the customer decides not to buy, ask which parameters they want to adjust.
      If the customer confirms the parameters meet their requirements, you must output in the following format:
      [Screen Size: 50-inch, Refresh Rate: 120Hz, Resolution: 1080P]. Output only the content in this format and no other information.
      
    • User Prompt:
      User's question: ${sys.query}
      
    • Memory: Enables the model to remember previous chat content during a conversation. Turn on the toggle image and select Custom Cache.
p910521
  1. Drag a LLM node from the left-side pane to the canvas. In its configuration panel, configure the following parameters, leaving others at their default values. Then, close the panel and connect the Buy mobile phone output of the Intent Classification node to the Large Model node.
    • Model Configuration: Select Qwen-Plus-latest.
    • Prompts:
      You are a smart shopping assistant responsible for recommending mobile phones to customers.
      You must proactively ask the user for mobile phone parameters in the order listed in the [Mobile Phone Parameter List] below. Ask for only one parameter at a time, and do not repeat questions for the same parameter.
      If the user provides a value for a parameter, continue to ask about the remaining parameters.
      If the user asks for the definition of a parameter, provide an explanation based on your professional knowledge, and then continue to ask which parameter value they prefer.
      If the user indicates they no longer wish to make a purchase, output: Thank you for visiting. We look forward to serving you next time.
      [Mobile Phone Parameter List]
      1. Usage Scenario: [Gaming, Photography, Watching movies]
      2. Screen Size: [6.4-inch, 6.6-inch, 6.8-inch, 7.9-inch foldable screen]
      3. RAM + Storage Space: [8GB+128GB, 8GB+256GB, 12GB+128GB, 12GB+256GB]
      After all parameters from the [Mobile Phone Parameter List] have been collected, ask: "Are you sure you want to purchase?" while also showing the parameters the customer has selected, for example: For photography|8GB+128GB|6.6-inch. Ask if they are sure about the mobile phone with these parameters. If the customer decides not to buy, ask which parameters they want to adjust.
      If the customer confirms the parameters meet their requirements, you must output in the following format:
      [Usage Scenario: Photography, Screen Size: 6.8-inch, Storage Space: 128GB, RAM Space: 8GB]. Output only the content in this format and no other information.
      
    • User Prompt:
      User's question: ${sys.query}
      
    • Memory: Enables the model to remember previous chat content during a conversation. Turn on the toggle image and select Custom Cache.
p910519
  1. Drag a Variable Processing node from the left-side pane to the canvas. In its configuration panel, configure the following parameters, leaving others at their default values. Then, close the panel and connect the Default intent output of the Intent Classification node to the Variable Processing node.
    • Output Mode: Select Text Output.
    • In the editor box, enter:
      Hello! Please tell me if you want to buy a TV, a refrigerator, or a mobile phone.
      
p910518
  1. Connect all three large model nodes and the Variable Processing node to the End node. Then, click the end node and, in its configuration panel's editor, enter / to insert the following four variables: Large Model 1/result, Large Model 2/result, Large Model 3/result, and Variable Processing 1/result. Leave other parameters at their default values.
p910518
Configuration example:
image
  1. Test the application:
    1. Click Test in the upper-right corner. In the dialog box, enter Tell me about your refrigerators, click image, and view the output.
    2. Next, enter Home use and view the output.
    3. Then, enter 200L and view the output.
    4. Finally, enter Level 1 energy efficiency and view the output.
工作流-智能导购

Session parameters

A session variable acts as a global variable, storing parameters throughout the workflow's lifecycle to be referenced by any node. Click the image icon in the upper-right corner of the canvas configuration page.
image

Node

Nodes are the core functional units of a workflow application. Each node performs a specific task, such as executing an action, triggering a condition, processing data, or directing the workflow. Combine these nodes like building blocks to create automated processes.
  • Start and end
  • Large model
  • Knowledge base
  • API
  • Plugin
  • Function Compute
  • Script
  • Condition
  • Intent classification
  • Flow output
  • Variable processing
  • Parameter extraction
  • Agent group
  • Create agent
  • Multimodal generation
  • When to use
    • When designing a workflow, define the structure and content of the input/output parameters in the start and end nodes.
  • How to use
    • Start node

      Component

      Description

      Predefined variables

      The workflow provides the following predefined variables to process user input and maintain conversation history:

      • query: Stores the user's text input.

      • historyList: Stores conversation history to maintain context in a multi-turn conversation. To use this variable in nodes that support the memory feature (such as large model and intent classification nodes), select Custom Cache.

      • imageList: Stores user-uploaded images to enable image analysis or multimodal conversation. To use this variable in nodes that support the memory feature (such as large model and intent classification nodes), select Custom Cache.

      Custom variables

      Custom variables are structured input parameters that you define for a workflow. They receive data from tests or API calls and can be referenced in subsequent nodes. When creating a custom variable, configure the following parameters:

      • Variable name: Enter a meaningful name. Chinese characters are not supported.

      • Type: The data type of the variable. Supported types are String, Boolean, Number, Object, Array (of String, Boolean, Number, or Object), and File.

      • Description: Briefly describe what the variable does and when to use it.

    • End node

      Component

      Description

      Output mode

      Text Output: Suitable for unstructured content. In the input box, you can enter fixed content or type / to reference variables, which determines the final result returned to the user. You can source variables from the output of any workflow node or from session variables. Properly mapping output variables allows you to control the workflow's data flow and ensure an accurate and complete final response.

      JSON Output: Suitable for outputting structured content in JSON format. You can define variable names and enter text or reference variables.

      Streaming output

      The Streaming Output switch applies only to Text Output mode.

      When enabled, responses from large model and application component nodes are streamed token by token. When disabled, a full response is returned after it is completely generated.

Test application

After you configure the workflow, you can use the test feature to verify that it runs as expected. Click the Test button in the upper-right corner to open the test panel. The test panel offers multiple test modes for different use cases.

Text conversation

Text conversation is the default test mode. It preserves the conversation history and supports continuous, multi-turn conversations.
  1. From the drop-down list at the top of the test panel, select text conversation mode (selected by default). If the workflow contains custom variables, enter their values in the parameter configuration area.
  2. In the input box, enter your test content (text and file attachments are supported), and then click the Send button or press Enter to run the test.
  3. Review the test results. You can click a node to view its detailed input and output, or switch the output format between Text and JSON.
  4. To continue the conversation, enter your next turn in the input box and send it. To start a new conversation, click the Clear All button.

Text generation

The text generation mode is for single-turn interactions. Each test is independent, and the conversation history is not preserved.

Checklist

The checklist lists the required configurations for your workflow. To view the checklist, click the image icon in the upper-right corner of the canvas configuration page.
image

Release an application

Once an application is released, you can call it via an API or share it as a web page with RAM users in the same main account. To do so, click the Publish button in the upper-right corner of the agent application management page.

Call via API

On the Publish Channel tab of your workflow application, click View API next to API to learn how to call the agent application by using an API.
Note: You must replace YOUR_API_KEY with your API key to call the API.
image
For FAQs and information about API calls, see the following topics: Currently, you cannot call the Xiyan service from a workflow. Instead, use an API node to call a custom API service.
The timeout for API calls is 600 seconds and cannot be changed. If a timeout may occur, consider the following solutions:
  • Use asynchronous mode: In this mode, the system returns a task ID. You can then use the task ID to query the result, which avoids the synchronous timeout limit.
  • Split the task: Break down the task into multiple steps, or process batch data in smaller chunks to prevent a single execution from timing out.

Import or export a workflow

  1. Import or export a Model Studio workflow Click the image icon at the top of the workflow page and select Export DSL or Import Model Studio DSL.
    image
  2. Import a Dify workflow Model Studio supports one-click import of Dify workflows for easy migration and reuse.
    1. Click the image icon at the top of the workflow page and select Import Dify DSL.
      image
    2. Adjust the parameters for each node.
      image
      The node compatibility details are as follows:

      Dify node

      Mapped Model Studio node

      Compatibility

      start

      start

      1. sys.query maps to query.

      2. sys.dialogue_count maps to maximum memory turns.

      LLM

      LLM

      1. model: Model Studio clears the model field for unsupported models, requiring you to select one manually. Supported models are fully compatible.

      2. prompt: Dify's System prompt maps to the main prompt in Model Studio, while its User prompt maps to the user prompt.

      3. vision capability: Fully compatible.

      4. context: Model Studio incorporates the raw fields from Dify's context directly into its system prompt.

      knowledge retrieval

      knowledge base

      1. input: Model Studio consistently uses the content field as the input.

      2. knowledge base: Model Studio clears this field after import. You must manually associate a knowledge base in Model Studio.

      3. retrieval settings: Dify's Top-k parameter maps to number of retrieved fragments.

      Direct Reply

      output node

      Fully compatible.

      agent

      None

      Only the name is retained. You must click the node and select a specific Model Studio node as a replacement.

      Question Classifier

      intent classification

      Model Studio clears the model field for unsupported models, requiring you to select one manually. Supported models are fully compatible.

      Iteration

      batch processing

      1. input: Maps to Batch Array.

      2. output variable: Maps to Output Variable.

      loop

      loop

      Fully compatible.

      code execution

      script

      Model Studio distinguishes between Python and JavaScript scripts.

      Template Transform

      None

      Not compatible. Model Studio generates a custom node.

      Variable Aggregator

      Variable Processing

      Maps to the Aggregate Groups output mode of the Variable Processing node.

      Document Extractor

      None

      Not compatible. Model Studio generates a custom node.

      Variable Assignment

      Variable Settings

      Fully compatible.

      Parameter Extractor

      parameter extraction

      Model Studio does not support inference mode. Other features are fully compatible.

      HTTP request

      API

      Fully compatible, but you must re-authenticate.

      List Operation

      None

      Not compatible. Model Studio generates a custom node.

      Tool

      plugin, MCP

      Not compatible. Model Studio generates a custom node.

      comment

      None

      Not compatible.

      end

      end

      If a Dify workflow contains multiple end nodes, Model Studio converts them into a single Variable Processing node and a single end node.

Manage workflow versions

  1. Click Publish in the top-right corner of the workflow configuration page. In the Publish dialog box, enter version information, such as 1.0.0, and click OK.
image
  1. Click Version Management at the top of the page, and in the Historical Versions panel, you can view or use different versions of the current workflow application as needed by clicking Overwrite Current Draft or Return to Current Version.
    You can also click Export DSL for This Version at the top to export the DSL of the selected historical version.
image
  1. Optional: In the Node Library, view or search for nodes.
image

Delete and copy workflow applications

In My Applications, find a published application card and click the image icon to delete the application, copy its workflow, or modify its application name.

image

FAQ

  • Workflow applications
  • Nodes
  1. How do I write the results of a workflow run to a database? Use a script conversion node to write the output from the previous node to a database.
  2. How do I upload files when building a workflow application in Model Studio? Add an API node to your workflow application to upload files.
  3. How do I upload images? Use a VL model and pass the image URL as a parameter.
  4. Can I use an asynchronous task API within a workflow application? The timeout for a workflow application is 600 seconds. Avoid using an asynchronous task API within a workflow.
  5. How can I call the Model Studio workflow API from a frontend application and receive a streaming output? Frontend calls are not currently supported.
  6. Why can't I import a standalone .yaml file into a Model Studio workflow? Model Studio does not support importing standalone .yaml files. You must provide a compressed package that includes an MD5 file. We recommend regenerating the MD5 if you encounter issues.
  7. Can variable names in Model Studio workflows be in Chinese? No, variable names cannot contain Chinese characters.
  8. How is conversation history stored? Workflow applications store data for only one month. You must save your own conversation history. The session_id is valid for one hour.