Create an AI-generated workflow
Serverless Workflow offers an AI generation feature to automatically build a workflow. Describe your business needs in natural language, and the service generates a complete framework, including sample inputs and outputs, full code, and a detailed workflow description.
Procedure
Log on to the Serverless Workflow console. From the top navigation bar, select a region.
On the Workflows page, click Create Workflow, select Use AI to Generate Workflow, enter your requirements, and then click Generate Workflow.
In the Use AI to Generate Workflow dialog box, select a scheme and click Use Scheme. You can also click Continue to Optimize, enter your refinements, and generate the workflow again.
The dialog box displays multiple scheme versions, such as V1 and V2, for comparison. For each version, a thumbnail of the workflow diagram is on the left and step descriptions are on the right. The toolbar at the bottom provides preset optimization tags: Inspiration, Generate Comments, Refine Workflow, Prioritize Function Compute, and Prioritize Self-hosted Gateway. These tags help you quickly specify the optimization direction. Click Generate Workflow.
After applying the scheme, you can edit the workflow on the Edit Workflow page. You can edit the workflow in two ways:
CloudFlow Studio
CloudFlow Studio provides a visual, drag-and-drop interface to design and edit your workflow. The following steps use an order management architecture as an example.
On the CloudFlow Studio tab, drag the required state nodes to the canvas.
Select each state node in the workflow diagram and configure its Basic Settings, Input Settings, Output Settings, and error handling.
(Optional) Select the Configure Workflow tab to set the execution role for the workflow. Then, click Save and Exit.
NoteIf your workflow involves integration with other cloud services, you must configure an execution role with the required permission policies. For more information, see execution role.
After orchestration, the workflow contains the following steps: Start → CreateOrder (FC:InvokeFunction) → CheckStock (FC:InvokeFunction) → DeductStock (FC:InvokeFunction) → ConfirmOrder (MNS:SendMessage) → End. For error handling, a
Catchbranch directs the flow to FailOrder (MNS:SendMessage) → End. Select a step node to configure its invocation parameters in the properties panel on the right. For example, the YAML configuration for theDeductStocknode includes fields such asresourceArn,invocationType, andbody.
YAML editor
Define and manage your workflow in a concise, human-readable YAML file. The following steps use an order management architecture as an example.
Select the YAML tab to switch to the YAML editor. Replace the YAML code with the code for the generated architecture.
(Optional) On the Workflow Configuration tab, configure the workflow role information. Then click Save and Exit in sequence.
NoteIf your workflow involves integration with other cloud services, you must configure an execution role with the required permission policies. For more information, see execution role.
On the CloudFlow Studio page, the YAML editor on the left defines a
StateMachinetype workflow (SpecVersion v1). It includes state nodes such asCreateOrder(FC:InvokeFunction, callingorder-service/createOrder),CheckStock(FC:InvokeFunction, callinginventory-service/checkStock, with aCatchbranch for error handling),DeductStock(FC:InvokeFunction),ConfirmOrder(MNS:SendMessage), andFailOrder(MNS:SendMessage). The panel on the right visualizes the workflow diagram in real time: Start → CreateOrder → CheckStock → DeductStock → ConfirmOrder → End. TheCatchbranch ofCheckStockpoints to FailOrder → End.