Phase 6: Dify & Visual AI App Builders · 55 min · Dify · OpenAI API · Python
Dify Workflow Orchestration — Visual Pipelines, Branching, and Iteration
Drag, connect, configure — no code required.
Hiring signal: Dify's workflow orchestration is its most powerful feature for complex AI pipelines. Being able to design a Dify workflow with LLM nodes, knowledge retrieval, conditional branching, and code nodes demonstrates the visual AI building skill that AI solutions architect roles require.
What you will learn
- Build Dify workflows with LLM nodes, Knowledge Retrieval nodes, Question Classifier nodes, and Code nodes
- Configure conditional branching: route to different nodes based on LLM output or classification result
- Use iteration nodes to process arrays (e.g., multiple documents, multiple questions)
- Connect Dify workflows to external systems via HTTP Request nodes and API publishing
The Problem
You need to build an AI pipeline that: classifies an email, routes it to the right processing branch, extracts data using an LLM, looks up additional information from an API, and sends the result to a CRM. In code, this is 200+ lines of Python with conditionals, API calls, and error handling. In Dify, it's a visual workflow: drag nodes onto a canvas, connect them, configure each one.
Dify's workflow orchestration is its most powerful feature for complex AI pipelines. It supports LLM nodes, knowledge retrieval, conditional branching, code execution, iteration over arrays, and HTTP requests — all visually.
Dify workflows are visual DAGs (directed acyclic graphs)
Each node does one thing (LLM call, code execution, HTTP request). Nodes connect to form a pipeline. Branching routes to different paths. Iteration loops over arrays. The result is a visual pipeline that's easy to understand, modify, and debug — without writing orchestration code.
The Concept
Dify Workflow Node Types
┌──────────────────────────────────────────────────────────────┐
│ DIFY WORKFLOW NODES │
│ │
│ ┌─────────┐ ┌──────┐ ┌───────────┐ ┌──────┐ │
│ │ Start │→ │ LLM │→ │ Knowledge │→ │ Code │ │
│ │ (input) │ │(model)│ │ Retrieval │ │(Python)│ │
│ └─────────┘ └──────┘ └───────────┘ └──────┘ │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────┐ │
│ │ Question │ │Conditional│ │Iteration │ │ End │ │
│ │Classifier│→ │ Branch │→ │ (loop) │→ │(output)│ │
│ └──────────┘ └──────────┘ └──────────┘ └──────┘ │
│ │
│ ┌──────────┐ ┌──────────┐ │
│ │ HTTP │ │ Template │ │
│ │ Request │ │ Transform│ │
│ └──────────┘ └──────────┘ │
└──────────────────────────────────────────────────────────────┘
| Node | What It Does | When to Use |
|---|
| Start | Defines input variables | Every workflow starts here |
| LLM | Calls an LLM with a prompt | Classification, extraction, generation |
| Knowledge Retrieval | Queries a connected knowledge base | RAG — retrieve relevant context |
| Question Classifier | Classifies input into categories | Route to different branches |
| Conditional Branch | Routes based on a condition | IF/ELSE logic |
| Code | Executes Python/JS code | Data transformation, validation |
| HTTP Request | Calls an external API | CRM, database, any REST API |
| Iteration | Loops over an array | Process multiple documents, multiple items |
| Template | Renders a Jinja2 template | Format output, construct prompts |
| End | Defines output variables | Every workflow ends here |
You need to process a batch of 10 documents: extract key fields from each, then aggregate the results. Which Dify node handles the "process each document" part?
The Iteration node loops over an array. You'd pass the 10 documents as an array variable, and the Iteration node runs its inner workflow (LLM extraction) once per document. The outputs are collected into an array. Without Iteration, you'd need 10 separate LLM nodes — one per document — which doesn't scale.
Conditional Branching
[Question Classifier: "Classify this email"]
↓
├── "order" → [LLM: Extract shipment fields] → [HTTP: Create order in TMS]
├── "complaint" → [LLM: Analyze sentiment] → [HTTP: Create ticket]
├── "invoice" → [LLM: Extract invoice data] → [HTTP: Send to AP system]
└── "other" → [HTTP: Route to human review]
Iteration Node
Input: documents = [doc1, doc2, doc3, ...]
[Iteration: for each document in documents]
└── [LLM: Extract fields from {{document}}]
└── [Code: Validate extracted fields]
Output: results = [
{fields: {...}, valid: true}, // doc1
{fields: {...}, valid: true}, // doc2
{fields: {...}, valid: false}, // doc3
...
]
Unlock the full lesson
You've read the first 2 sections. The rest of this lesson covers Build It, Use It, Ship It, Exercises, Key Terms, Common Pitfalls — plus a hands-on lab, quiz, and project artifact.
Create a free account to unlock Phase 0 and Phase 1 of every course — no credit card.
Browse all courses · View pricing · DeVenture Academy