Build a multi-step workflow on the canvas
Wire your first nodes on the visual canvas
So far you have used Chatbot apps. The third app type, Workflow, is where Dify becomes a builder: a visual drag-and-drop canvas of typed nodes you connect into a multi-step pipeline. The available node types include LLM, Knowledge Retrieval, Question Classifier, Tools, Code (Python/Node.js), If/Else, Iteration, Template, and Parameter Extractor. In this lesson you assemble a small pipeline by hand.
- 1 In the Studio, click Create App → Workflow.
- 2 On the canvas, add a Knowledge Retrieval node and point it at the knowledge base you built earlier.
- 3 Add an LLM node and connect the retrieval output into it, so the model writes its answer using the retrieved chunks.
- 4 Add an If/Else node to branch — for example, route long questions one way and short ones another — then run the workflow with a test input.
- 5 Watch the run trace light up each node in order; confirm an answer comes out the end.
A multi-node workflow runs end to end on the canvas, retrieving from your knowledge base and producing a grounded answer through an LLM node.
Nodes are typed building blocks, not free-form prompts
A workflow is not one big prompt — it is a graph of typed nodes, each doing one job and passing its output to the next. Understanding the node vocabulary is what lets you design pipelines instead of hoping a single prompt covers everything.
Each Dify node has a defined role: Knowledge Retrieval fetches grounded chunks, LLM generates text, Question Classifier sorts an input into categories, If/Else branches on a condition, Iteration loops over a list, Parameter Extractor pulls structured fields out of text, Template formats output, Code runs Python or Node.js, and Tools calls an external capability. Because each node's output is typed and visible in the run trace, you can see exactly where a multi-step pipeline succeeds or fails — the opposite of a single opaque prompt.
- ?In your workflow, which node would you add a Question Classifier before — and what would the branches be?
- ?Where in a science pipeline would Iteration matter (hint: doing the same step across many items)?
- ?If the final answer was wrong, which node's output would you inspect first in the run trace?
Add a branch that handles two kinds of question
Real pipelines rarely treat every input the same. A classifier plus a branch is the smallest design that makes a workflow feel intelligent rather than linear.
Extend your workflow with a Question Classifier so factual lookups and open-ended questions take different paths, then test both.
- 1 Add a Question Classifier node near the start of the workflow with two categories, e.g.
factual lookupandopen discussion. - 2 Route the
factual lookupbranch through your Knowledge Retrieval + LLM path. - 3 Route the
open discussionbranch to an LLM node without retrieval (or with a different instruction). - 4 Run one input of each type and confirm they take different paths in the trace.
A workflow that classifies an input and sends each class down a different node path, demonstrated with one test of each branch.