Skip to main content

Overview

Workflow applications break down complex tasks into a series of sequentially executed steps to reduce system complexity. In Alibaba Cloud Bailian, you can combine large language models (LLMs), APIs, Function Compute nodes, and other components within workflows—significantly lowering development overhead. This article explains how to create a workflow application.

Application Overview

Why Use Workflow Applications?

A workflow is a method for decomposing complex tasks into a sequence of ordered steps—designed to simplify system complexity and improve operational efficiency. In modern software development and business process management, workflow applications have become increasingly essential. By building workflow applications on the Alibaba Cloud Bailian platform, you can clearly define task execution order, responsibility assignment, and inter-step dependencies—enabling automation and optimization. Workflow applications support numerous use cases, including:
  • Travel Planning: Users select parameters such as destination via a workflow plugin, and the system automatically generates a comprehensive travel plan—including flight bookings, accommodations, and attraction recommendations.
  • Report Analysis: For complex datasets, workflows combine data processing, analytical, and visualization plugins to generate structured, formatted analytical reports tailored to diverse business needs.
  • Customer Support: Automated workflows handle customer inquiries—including issue classification—to accelerate response times and improve accuracy.
  • Content Creation: Workflows generate articles, marketing copy, and other content types. Users only need to provide a topic and requirements; the system produces compliant drafts automatically.
  • Education & Training: Workflows design personalized learning paths—including progress tracking and assessments—to enable self-directed student learning.
  • Medical Triage: Based on patient-reported symptoms, workflows integrate multiple analytical tools to produce preliminary diagnoses or recommend relevant tests—assisting physicians in further evaluation.

Node Types

A workflow is composed of functional nodes. Start and End nodes are intrinsic to the canvas and exist at both ends of the flow. Add other nodes from the categorized library on the left:

Session Variables

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

Test the 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. It supports two modes:
  • Synchronous run: For simple, fast tasks. Returns the result immediately upon completion.
  • Asynchronous run: For complex, time-consuming tasks. Returns a Task ID that you can use to query the result.

Synchronous Run

In synchronous run mode, the workflow executes immediately and returns the result directly upon completion.
  1. In the input box, enter your test content and click the Run button to start the test.
  2. After the workflow finishes running, switch to the Result tab to view the output. You can click a node to view its detailed input and output, or switch the output format between Text and JSON.

Asynchronous Run

In asynchronous run mode, the workflow executes in the background. The system immediately returns a Task ID, which you can use to query the result. You can also view the history of asynchronous tasks in the Task Center.
  1. In the input box, enter your test content and click the Run button to start the test. The system immediately returns a Task ID.
  2. While the asynchronous task is running, the test panel displays an "Executing" status. You can click the Refresh button to refresh the status.
  3. After the task is complete, view the output on the Result tab. The output includes an "Async" tag and the Task ID. You can click a node to view its detailed input and output, or switch the output format between Text and JSON.

Voice Interaction and Video Interaction

Voice Interaction and Video Interaction are two independent test modes in the test panel. You can publish a workflow application as a real-time voice or video conversation application. It provides a convenient debugging window where you can quickly test a demo on an H5 or mobile app. You can also integrate the application into your web, iOS, or Android applications using an audio and video SDK.
  • We do not recommend using models with high latency for real-time audio and video conversations, as it may affect the conversation experience. Examples include the DeepSeek-R1 and QwQ series models.
  • The DeepSeek V3 model does not support video chat.
  1. Create a workflow by configuring a Start node, a large language model node, and an End node.
  2. In Test > Text Chat, debug the application until it performs as expected.
  3. After you are satisfied with the text conversation performance, switch to Interactive voice response or Video Interaction mode. Then, click Configure to set up the API key to call the application.
  4. In Audio & Video Settings, configure the parameters, and then click Call to debug the audio and video interaction. Under speech-to-text, you can select the language; under text-to-speech, you can select the voice model and timbre.
  5. Once you are satisfied with the test results, click the Try button in the upper-right corner to generate a temporary QR code for testing. You can scan the QR code with WeChat, DingTalk, or a mobile browser to test the interaction. The QR code is valid for 24 hours.
  6. After confirming the performance, click the Publish button to publish the application. Then, go to the Publish Channel, activate Intelligent Media Service, grant SLR authorization, and create an interactive agent.

Checklist

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

Publishing and Invocation

After configuring and testing your workflow, click Publish in the top-right corner to deploy the application. Once published, it can be invoked via API.
To invoke using the Responses API, see Responses API Invocation.

Prerequisites

  1. You have obtained an API Key and configured it in your environment variables.
  2. You have created a workflow application and retrieved its APP_ID from the application card on the Application Management page.
  3. If invoking via the DashScope SDK, ensure the DashScope SDK is installed.

Quick Start

import os
from http import HTTPStatus
from dashscope import Application

response = Application.call(
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    app_id='APP_ID',  # Replace with your actual application ID
    prompt='Who are you?')

if response.status_code != HTTPStatus.OK:
    print(f'request_id={response.request_id}')
    print(f'code={response.status_code}')
    print(f'message={response.message}')
else:
    print(response.output.text)

Node Execution Status

The output.thoughts[] array in the response returns execution information for each node, in execution order. The response field of each element is a JSON string containing the following fields:
FieldTypeDescription
nodeIdstringNode ID.
nodeNamestringNode name.
nodeTypestringNode type, such as Start, LLM, or Script.
nodeStatusstringNode execution status. See the table below for valid values.
nodeResultstringNode output, as a JSON string. Not returned for nodes without output, such as the Start node.
nodeExecTimestringNode execution duration, such as 1167ms. Not returned while the node is still running.
Valid values for nodeStatus:
ValueDescription
successThe node ran successfully.
failThe node failed.
skipThe node was skipped and did not run.
executingThe node is running and nodeResult is empty. In streaming mode, a node first returns executing, then returns its final status once complete.

Multi-turn Conversations

Compared to single-turn interactions, multi-turn conversations allow the LLM to reference prior dialogue history—making interactions more natural and aligned with real-world communication.
import os
from http import HTTPStatus
from dashscope import Application

def call_with_session():
    response = Application.call(
        api_key=os.getenv("DASHSCOPE_API_KEY"),
        app_id='APP_ID',
        prompt='Who are you?')

    if response.status_code != HTTPStatus.OK:
        print(f'request_id={response.request_id}')
        print(f'code={response.status_code}')
        print(f'message={response.message}')
        return response

    responseNext = Application.call(
                api_key=os.getenv("DASHSCOPE_API_KEY"),
                app_id='APP_ID',
                prompt='What skills do you have?',
                session_id=response.output.session_id)

    if responseNext.status_code != HTTPStatus.OK:
        print(f'request_id={responseNext.request_id}')
        print(f'code={responseNext.status_code}')
        print(f'message={responseNext.message}')
    else:
        print('%s\n session_id=%s\n' % (responseNext.output.text, responseNext.output.session_id))

if __name__ == '__main__':
    call_with_session()

Passing Custom Parameters

When invoking a workflow application, dynamic parameters are uniformly encapsulated in the input object, which contains two key fields:
  • prompt: Carries the user’s primary input. This content is automatically mapped to the built-in workflow variable {{query}}, requiring no manual definition.
  • biz_params: Passes custom business parameters as key-value pairs (e.g., {"city": "Hangzhou"}). These must be pre-declared in the workflow’s Start node, after which they become globally accessible across all nodes via {{parameter_name}}.
For detailed usage instructions, see Passing Custom Parameters via API.

Import or Export a Workflow

  1. Import or export a Model Studio workflow Click the more icon at the top of the workflow page and select Export DSL or Import Model Studio DSL.
  2. Import a Dify workflow One-click import of Dify workflows is supported for easy migration and reuse.
    1. Click the more icon at the top of the workflow page and select Import Dify DSL.
    2. Adjust the parameters for each node. The node compatibility details are as follows:
    Dify nodeMapped nodeCompatibility
    startstartsys.query maps to query; sys.dialogue_count maps to maximum memory turns.
    LLMLLMModel: unsupported models are cleared and must be selected manually, supported models are fully compatible; Prompt: Dify's System maps to the main prompt, User maps to the user prompt; vision capability is fully compatible; context: the raw fields from Dify's context are incorporated directly into the system prompt.
    knowledge retrievalknowledge baseInput: the content field is consistently used as input; knowledge base: cleared after import and must be associated manually; retrieval settings: Dify's Top-k maps to the number of retrieved fragments.
    Direct Replyoutput nodeFully compatible.
    agentNoneOnly the name is retained. Click the node and select a specific node as a replacement.
    Question Classifierintent classificationUnsupported models are cleared and must be selected manually; supported models are fully compatible.
    Iterationbatch processingInput maps to Batch Array; output variable maps to Output Variable.
    looploopFully compatible.
    code executionscriptPython and JavaScript scripts are distinguished.
    Template TransformNoneNot compatible. A custom node is generated.
    Variable AggregatorVariable ProcessingMaps to the Aggregate Groups output mode of the Variable Processing node.
    Document ExtractorNoneNot compatible. A custom node is generated.
    Variable AssignmentVariable SettingsFully compatible.
    Parameter Extractorparameter extractionInference mode is not supported; other features are fully compatible.
    HTTP requestAPIFully compatible, but you must re-authenticate.
    List OperationNoneNot compatible. A custom node is generated.
    Toolplugin, MCPNot compatible. A custom node is generated.
    commentNoneNot compatible.
    endendIf a Dify workflow contains multiple end nodes, they are converted 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.
  2. Click Version Management at the top of the page. 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 to export the DSL of the selected historical version.
  3. (Optional) In the Node Library, view or search for nodes.

Delete and Copy Workflow Applications

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

FAQ

Workflow Applications

Use a script conversion node to write the output from the previous node to a database.
Add an API node to your workflow application to upload files.
Use a VL model and pass the image URL as a parameter.
The timeout for a workflow application is 600 seconds. Avoid using an asynchronous task API within a workflow.
Frontend calls are not currently supported.
Importing standalone .yaml files is not supported. You must provide a compressed package that includes an MD5 file. We recommend regenerating the MD5 if you encounter issues.
No, variable names cannot contain Chinese characters.
Workflow applications store data for only one month. You must save your own conversation history. The session_id is valid for one hour.

Nodes

If you enable context for an intent classification node, the variable that you pass to it must be a list.
The API node within a workflow does not support streaming output. However, streaming output is supported by the underlying HTTP API.
  • Check your workflow configuration: ensure each node, especially the conditional node, is configured correctly. Avoid unnecessarily complex calculations or data processing.
  • Optimize script logic: if the conditional logic involves a custom script, optimize it by reducing unnecessary loops or redundant data processing.
  • Run batch tests: measure the average response time of your workflow to identify performance bottlenecks under specific conditions.
Add a text conversion node after the large model node, configure the reasoning_content variable, and enable Result Return. The end node must receive the result.
  • Use a script node to process the output: add a script node after the large model node to process its output, convert it to your desired format, or add extra parameters.
  • Configure a batch node: if you are using a large model node within a batch node, select the output of the large model node as the final output resultList in the batch node's configuration.
For more details, see Passing Custom Parameters via API.
Verify that your API key and Base URL are correct. Ensure that the input parameters are configured correctly, and adjust the field input types if necessary. Use Model Observation to view model usage details.
You cannot directly access local files. Use MCP to access local resources. You must manually process the output from a knowledge base node. We recommend adding a large model node to convert the output to a table format before passing it to a script node for further processing.