All Products
Search
Document Center

Container Service for Kubernetes:Scheduling Dify workflows via XXL-JOB

Last Updated:Mar 26, 2026

Dify workflows need scheduling for use cases such as risk monitoring, data analytics, content generation, and data synchronization. Dify does not natively support scheduling. This guide shows how to integrate XXL-JOB, a distributed task scheduling system, to schedule and monitor Dify workflow applications and keep them running reliably.

How it works

XXL-JOB connects to a published Dify workflow application through its API. Once configured, XXL-JOB triggers the workflow on your defined schedule, tracks each execution, and sends alerts when failures or timeouts occur.

The integration takes three steps:

  1. Create a Dify environment: Create a Container Service for Kubernetes (ACK) cluster, install the ack-dify component, and publish a workflow application.

  2. Create and configure a scheduling instance: Create an XXL-JOB scheduling instance, group tasks into an application, and connect the task to your Dify workflow API.

  3. Test the integration: Run the task once and verify the execution details.

Key features

Feature Description
Task support Schedules self-hosted Dify workflows on the public network and in an Alibaba Cloud internal network environment
Flexible time configuration Supports cron, fixed_rate, fixed_delay, one_time, and API-based scheduling with second-level precision; supports timezone settings and custom calendars
Alerts and monitoring Integrates with CloudMonitor for contact and contact group management; supports failure, timeout, and success alerts at the task level, and threshold-based alerts at the application and instance levels; notifies via SMS, phone, webhook, and email
Scheduling dashboard Visualizes scheduling trends, success rate, and failure rate at the instance and application levels
Execution history Records status, basic information, input and output parameters, duration, and token usage for each execution
Event tracking Logs workflow-level and node-level events for each schedule; supports drill-down into loops, iterations, and conditional branches

Prerequisites

Before you begin, make sure you have:

  • An Alibaba Cloud account with ACK activated and authorized. For details, see Quick creation of an ACK managed cluster.

  • An XXL-JOB scheduling instance (engine version 2.2.0 or later). If you do not have one, create it in step 2.

Step 1: Create a Dify environment

1. Deploy the Dify environment

To install the ack-dify component and enable public network access for the Dify service, use one-click deployment for a Dify environment.

Note

This guide uses public network access for demonstration purposes. For production environments, enable Resource Access Management (RAM) to protect your application data.

If you are new to ACK clusters, click One-click deployment to create the necessary runtime environment. This solution uses the ack-dify application template from the ACK App Marketplace to deploy a Dify application with Helm, meeting development and testing needs.

Important

Before using one-click deployment, activate and authorize the Container Service for Kubernetes (ACK) cluster. For details, see Quick creation of an ACK managed cluster.

  1. Click One-click deployment. In the Resource Orchestration Service (ROS) bar at the top, select your region (for example, China (Hangzhou)). Configure the cluster Zone, Instance Type, and Instance Password, and check the Security Confirmation box. Keep the default settings for other options, then click Create.

  2. Cluster creation takes about 10 minutes. After the cluster is created, log on to Container Service console > Clusters. Click the target cluster name, go to Workloads > Pods, set the namespace to dify-system, and verify that the ack-dify component resources are installed correctly.

  3. (Optional) If a Pod is in the Pending state, it may be missing a PVC dependency. Create a default CNFS file system and a corresponding NAS StorageClass for the cluster. For details, see Manage NAS file systems using CNFS (recommended). For troubleshooting Pod anomalies, see Troubleshoot pod exceptions.

Once the ack-dify component is installed, proceed to the next step.

2. View the external IP address

Go to Network > Services > ack-dify and set the namespace to dify-system. Copy the External IP of the ack-dify service and open it in your browser.

image

3. Register the Dify service

On the Dify setup page, follow the on-screen instructions to configure an admin account with an email address, username, and password.

image

4. Create a Dify workflow application

Import the sample file dify-flow.yml into Dify to quickly build and publish a workflow application for the scheduling test.

Important

XXL-JOB supports only Dify workflow applications. Chat-type applications are not supported.

image

Step 2: Create and configure a scheduling instance

1. Create an instance

Log on to the XXL-JOB console, select a Region from the top menu bar, and set the Instance Name and VPC ID. Make sure the engine version is 2.2.0 or later. Click Buy Now.

  • Region: Must match the Dify cluster region.

  • Instance Name: For example, Dify-demo.

  • Virtual Private Cloud (VPC) ID: Must match the Dify cluster VPC.

image

2. Create an application

Applications logically group tasks. Each application acts as an independent task execution unit, making it easier to view, configure, and schedule tasks.

On the XXL-JOB instance page, find the target instance and click Task Management in the Actions column. In the left navigation pane, select Application Management, then click Create Application.

  • AppName: For example, Dify-AppName.

  • Name: For example, Dify-AppName.

  • AccessToken: Auto-generated by the system.

image

3. Create a task

A task is the specific unit of business logic to be scheduled. After you create an application, bind it to a task executor. Once registered with the application via its AppName, the executor can run tasks under that application.

Note

Create the application before creating a task. Without an application, the executor cannot register and tasks cannot run.

  • Task Name: For example, Dify-test.

  • Associated Applications: Select the application you just created, such as Dify-AppName.

  • Job Type: Dify workflow.

  • Other parameters: Keep the default settings.

image

4. Configure task parameters

After publishing the Dify workflow application, click API Access to get the required task parameters.

  • Endpoint: The API server of the Dify workflow.

  • API Key: The API key for the workflow. Each workflow has a unique key.

  • Input: The workflow input in JSON format. For example:

    {"input_text": "what is your name"}

image

Step 3: Test the integration

1. Run a test task

Go to Task Management and click Run Once to trigger the task immediately and verify that the scheduling function is working.

image

2. View scheduling details

Go to Execution List and click Details to confirm the task completed successfully and review its execution record.

image.png

3. Review execution details

Click Details to view:

  • Basic information

  • Input and Output

  • Node Track: For structures like iterators and loops, drill down to view more detailed node information.

image.png

Disclaimer

Dify on ACK is a Helm deployment solution that adapts the open-source Dify project for the Alibaba Cloud ACK environment, enabling rapid deployment. ACK does not guarantee the operation of the Dify application itself or its compatibility with other ecosystem components, such as plugins and databases. ACK does not provide compensation or other commercial services for business losses caused by defects in Dify or its ecosystem components. Follow updates from the open-source community and proactively fix issues in the open-source software to ensure the stability and security of your Dify deployment.