workflow/Nodes and Modules (Modules)

5.4 Nodes and Modules (Modules)

In Pop’s workflow system, a Module is a higher‑level logical unit compared to a single node.
It allows you to package a group of nodes into a “sub‑workflow” that exposes inputs and outputs — essentially behaving like a custom node.

Modules make your workflows easier to manage, reuse, and scale, especially for:

  • Multi‑step repeated operations
  • Breaking down complex processes
  • Sharing common logic across teams
  • Building industry templates (automated reports, KB pipelines, customer‑service SOPs, etc.)

This chapter explains the concepts, usage, best practices, and scenarios for Modules.


🧩 1. What Is a Module?

A Module is a reusable component composed of multiple nodes.

Think of it as:

Module = Sub-workflow (with its own nodes, connections, variables, inputs, outputs)

On the canvas, it appears as a single node:

┌──────────────────────────┐
│     Module: Text Cleaner  │
│  Inputs: text             │
│  Outputs: clean_text      │
└──────────────────────────┘

Double‑clicking it opens the internal workflow.

Module characteristics:

  • Collapsible / expandable (keeps canvas clean)
  • Reusable (drag into any workflow)
  • Exportable / importable
  • Input / output ports
  • Supports nested modules

📦 2. Typical Use Cases

✔ 1. Reusing common logic

Examples:

  • Text cleaning (newline removal, HTML removal, trimming)
  • AI summarization templates
  • PDF → parsing → cleaning → JSON output

These are repeated often—modules greatly reduce duplication.


✔ 2. Breaking down complex processes

Example: An automated report generation pipeline:

Raw Data → AI Summary → Chart Generation → PPT Generation → Upload

You may break it into:

  • Data Preprocessing Module
  • AI Writing Module
  • Chart & PPT Module

This keeps the main workflow clean and readable.


✔ 3. Building industry capability libraries

Such as:

  • Finance report generator
  • Daily operation report
  • SEO article generator
  • Video script generator
  • Knowledge base indexing module

Modules = reusable capabilities.


🏗 3. How to Create a Module

Select multiple nodes → Right‑click → “Create Module”

The system will automatically create:

  • Module name
  • Module ID
  • Input ports (based on internal unconnected inputs)
  • Output ports (based on internal unconnected outputs)

You can then adjust ports manually.


🎚 4. Module Inputs & Outputs

Modules expose Ports.

Example:

Inputs:
  - text: string
  - max_tokens: number

Outputs:
  - summary: string

Inside the module, these ports behave like normal node I/O.


🔧 5. Editing Module Internals

Double‑click to enter the module editor. You can:

  • Add/remove nodes
  • Adjust internal connections
  • Add sub‑modules
  • Configure variables
  • Define logic
  • Debug module execution

Modules also have independent execution logs.


🧱 6. Module Parameters (Config)

Modules can define configuration parameters like standard nodes.

Example:

{
  "temperature": 0.4,
  "language": "zh"
}

This increases flexibility:

  • Summary module accepts different lengths
  • KB retrieval module selects different KB sources
  • Data cleaning module keeps selectable fields

🔁 7. Importing & Exporting Modules

Modules can be exported as standalone JSON.

Export includes:

  • Module metadata (id, name, icon)
  • Internal nodes and edges
  • Input/output ports
  • Variables
  • Nested module references

After import:

The module becomes available in any Pop environment.
Perfect for:

  • Team sharing
  • App templates
  • Industry solutions

🧭 8. Best Practices

✔ 1. Single Responsibility

A good module:

  • Has clear inputs
  • Produces clear outputs
  • Has independent internal logic
  • Minimizes external dependencies

✔ 2. Use naming conventions

Recommended structure:

Category/Function-Verb

Examples:
- Text/Summarization
- Finance/Report-Analysis
- Document/KB-Ingestion
- Marketing/Short-Video-Script
- Data/Formatting

✔ 3. Break down complex logic

Avoid overloading one module.


✔ 4. Combine Modules with Layouts

When publishing apps:

  • Bind module outputs to charts/tables/cards
  • Make apps highly composable

🧠 9. Modules vs Groups (Composite Nodes)

Feature Module Group (Composite)
Changes workflow structure ✔ Yes ✖ No
Reusable as node ✔ Yes ✖ No
Exposes inputs/outputs ✔ Yes ✖ No
Supports nesting ✔ Yes ✔ Yes
Use case Functional reuse Visual organization

Summary:
Groups manage layout; Modules manage logic.


📝 10. Example: Building an “AI Summary Module”

Internal logic:

Input text
  ↓
Clean text
  ↓
Construct prompt
  ↓
LLM call
  ↓
Return summary

Exposed externally:

Inputs:
  - text
Outputs:
  - summary

Use cases:

  • Weekly report generation
  • Document summarization
  • Batch content processing

✅ Summary

Modules are one of the most important workflow structures in Pop, enabling:

  • Logic encapsulation
  • Reusable capabilities
  • Industry solution templates
  • Cleaner canvases
  • Higher maintainability

Mastering modules enables you to build large‑scale, efficient, reusable automation systems.