Skip to main content

Subflow

The Subflow node is a special node type in the XpertAI workflow orchestration system. It encapsulates a complete segment of process logic into an independent module, which can be reused in the main workflow through a "call" mechanism. This design significantly enhances the modular management, reusability, and maintainability of workflows.

๐Ÿ›  Functionality and Use Casesโ€‹

Subflow nodes are suitable for the following typical scenarios:

  • Reusing logic that appears repeatedly across multiple workflows, such as employee onboarding initialization, invoice approval, or troubleshooting.
  • Breaking down complex logic into clear, modular components to keep the main workflow concise.
  • Independently developing, testing, and maintaining specific workflow logic, reducing risks associated with changes to the main workflow.

๐Ÿงท Example: Subflow Node in Employee Onboarding Workflowโ€‹

In a company's "Employee Onboarding Automation Workflow," a subflow node named [Onboarding Process] encapsulates the following IT initialization operations:

  • Creating an enterprise email for the employee.
  • Assigning office equipment.
  • Adding the employee to the department email group.
  • Sending a welcome email.

๐Ÿ‘‡ Partial Workflow Diagram:

Subflow node
Subflow Node

๐Ÿงฌ Node Capabilitiesโ€‹

CapabilityDescription
Input Parameter PassingThe main workflow can pass contextual parameters (e.g., employee name, email) to the subflow.
Output Result ReturnThe subflow can return processing results to the main workflow after execution.
Error Isolation and Fault ToleranceSubflow failures can be handled independently without affecting the overall main workflow.
Multiple ReusesSubflows can be called by multiple main workflows, such as "Intern Onboarding" or "Job Transfer Workflow."
Nested Support (Optional)Subflows can reference other subflows (if enabled), enabling complex multi-level logic organization.

The Subflow node supports parameter passing between the main workflow and the subflow, categorized into Input Variables and Output Variables, as described below:

๐Ÿ”ธ Input Variablesโ€‹

Used to pass data from the main workflow to the subflow.

As shown, the configuration format is:

Main Workflow Variable โž Subflow Variable

For example:

Subflow Variable (Recipient)Main Workflow Variable (Source)
employee_nameemployee_info

This indicates that the employee_info variable from the main workflow is passed to the subflow and assigned to the employee_name variable.

๐Ÿ”ธ Output Variablesโ€‹

Used to return processing results from the subflow to the main workflow.

The configuration format is:

Subflow Variable โž Main Workflow Variable

For example:

Main Workflow Variable (Recipient)Subflow Variable (Source)
emailsys.user_email

This indicates that the sys.user_email variable from the subflow is output to the email variable in the main workflow, available for subsequent nodes, such as subflow_jzsikojwdp_channel.email corresponding to the email output variable of the "Subflow" node.

โœ… Operation Tips:โ€‹

  • Multiple mapping entries can be added by clicking the โž• button.
  • Subflow variable sources are typically system variables or intermediate computation results within the subflow.

Through this mechanism, the Subflow node achieves data decoupling and reuse between workflow modules, serving as a key capability for building large-scale workflow automation systems.

โš™ Usage Guidelinesโ€‹

How to Create a Subflow Node?โ€‹

  1. Add a new subflow node and name it (e.g., "Onboarding Process Subflow").
  2. Add an agent node as the entry point to the subflow.
  3. Add more nodes to the workflow associated with the agent node.
  4. Configure input and output parameter mappings.

๐Ÿš€ Application Valueโ€‹

  • โœ… Increases workflow reuse, avoiding redundant development.
  • โœ… Reduces main workflow complexity, improving readability.
  • โœ… Supports division of workflow responsibilities, facilitating multi-team collaboration.
  • โœ… Enhances workflow maintainability and scalability.

๐Ÿ“˜ Example Digital Expert: Smart HR Assistantโ€‹

In the employee onboarding automation scenario, a subflow node is used to build a clear, automated onboarding workflow. Refer to the template Smart HR Assistant.