Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
16 KiB
Building in Dify: from workflow to agent
Guide 1 for the AI Agents workshop
LeX Consultancy B.V. · 20 September 2026
This guide follows the cloud version of Dify as it looked on 20 September 2026. Dify changes fast: if your screen differs, follow what you see, not what is written here.
How to read this guide
| Form | Meaning |
|---|---|
| 1. 2. 3. | What you do: click, choose, open |
| Bold | A button, menu or field as it appears on your screen |
| Table What you type | Values you put in a form field |
| Grey box Type in | Text you type or paste literally |
| Orange box | A pitfall you would otherwise discover yourself |
| Green box Your choice | A place where you can replace our example with your own material, style or prompt |
The design card for this app
Before we started clicking, this card was filled in (the blank card is in the Design card appendix). Fill in the same five boxes for your own app; the loose version of this filled-in card is in 00-design-card/examples.
| 1. Who is it for | 2. What goes in |
|---|---|
| An English teacher with a reading text from the course book that is too hard for half of Year 9. Has ten minutes before the lesson and does not want to rewrite it by hand. | The text (pasted, a Paragraph field) and the level from a short list: year 6, year 7, year 9, year 12 (a Select field). |
| 3. What comes out | 4. What it must stick to |
|---|---|
| The text rewritten at the chosen level, with all the content kept and technical terms explained in a subordinate clause; below it three comprehension questions (fact, main idea, application) without answers. | Short sentences, leave nothing out, do not replace technical terms. No knowledge base needed: the rules live in the prompts of the two LLM steps. |
5. How you know it works
| Test | What goes in | What must come out |
|---|---|---|
| 1 | A paragraph from a geography course book, level year 7 | Shorter sentences, same facts, three questions that are about the text |
| 2 | The same paragraph, level year 12 | Barely simplified, questions at analysis level |
| 3 (the hard one) | A text with a table of figures, level year 6 | The figures stay correct; the app invents no new numbers |
Preparation
- Go to cloud.dify.ai and log in.
- You arrive in Studio: this is where all your apps live.
Top left you see your workspace with the label SANDBOX and your number of credits. That number is a one-off allowance, not per month.
Step 1. Create a new app
- Click Create at the top right.
- Choose Create from Blank. You see two kinds: Workflow and Chatflow.
- Click MORE BASIC APP TYPES. Now Chatbot, Agent and Text Generator appear as well. This is the button everyone misses when they want to build an agent.
| Type | What it is | What for |
|---|---|---|
| Workflow | Fixed steps from input to output | Producing material, always the same route |
| Chatflow | A workflow with a chat window and memory | A conversation with a fixed structure |
| Chatbot | A chat window with an instruction | Trying something out quickly |
| Agent | A goal plus tools; chooses its own steps | A conversation partner that thinks along |
| Text Generator | Text tasks | One-off text jobs |
- Click Workflow.
- Fill in the name.
| Field on screen | What you type |
|---|---|
| App name | Text at level |
- Click Create.
Step 2. Choose a start node
A workflow does not start by itself. In the right-hand panel you choose what triggers it: User Input, Schedule Trigger or Webhook Trigger.
- Click User Input in the right-hand panel.
The node is now on the canvas. On the right you see INPUT FIELD with a plus sign: that is where you create the fields the user will fill in.
Step 3. Create two input fields
Field 1: the text
- Click the plus sign next to INPUT FIELD.
- Open Field Type at the top.
- Choose Paragraph.
- Fill in the two fields.
| Field on screen | What you type |
|---|---|
| Variable Name | text |
| Label Name | The text you want to adapt |
Watch out: as soon as you type the variable name, Dify fills the label field with that same name. Clear that field before typing your own label, otherwise you end up with
textThe text you....
- Click Save.
Field 2: the level
- Click the plus sign next to INPUT FIELD again.
- Set Field Type to Select.
- Fill in the two fields.
| Field on screen | What you type |
|---|---|
| Variable Name | level |
| Label Name | For which level |
- Click Add option four times.
- Click in each empty box and type one option per line.
| Option | What you type |
|---|---|
| 1 | year 6 |
| 2 | year 7 |
| 3 | year 9 |
| 4 | year 12 |
After each new line, click in the empty box first before you type. If you do not, your text ends up nowhere.
Your choice: the levels. These four options are an example. Put in the levels you actually teach: "year 3", "vocational year 2", "adult learners", "ESL A2", or something else entirely such as "colleague", "parent", "governor". The option later becomes the literal word that goes into the prompt, so choose words the model can work with.
- Click Save. Both fields are now in the node.
Step 4. Add the first thinking step
- On the right, under NEXT STEP, click SELECT NEXT STEP. You get the list of nodes.
- Choose LLM.
Set the model right straight away
The node defaults to gpt-5. That costs five credits per answer. gpt-5-mini costs one. With two hundred credits that is the difference between forty and two hundred answers.
- Click the model name gpt-5.
- Choose gpt-5-mini.
Write the prompt
- Click in the SYSTEM field.
- Type the instruction.
Rewrite the text below so that a student at this level can read it. Keep all the factual content. Do not replace technical terms, but explain them in a subordinate clause. Write short sentences.
- Press Enter for a new line and type:
Level:
- Right after it, type a forward slash
/. A list of your input fields appears. - Choose level from the list. No need to type curly braces; Dify inserts the variable itself.
Your choice: the prompt. The instruction above is the heart of your app. Want the text to get shorter too? Add: "Make the text at most half as long." Want difficult words in bold and explained at the bottom? Say so literally. Want the style of your own course book? Paste a paragraph from it as an example, preceded by "Write in this style:". Change one thing at a time and test again (step 7); then you know which change has which effect.
- Press Enter and type:
Text:
- Type a forward slash
/again and choose text. The prompt is now complete.
Step 5. Add the second thinking step
- Scroll down in the right-hand panel.
- Click SELECT NEXT STEP and choose LLM again.
- Click the model name and choose gpt-5-mini.
If a message appears saying the temperature parameter was removed because the model does not support it: ignore it, nothing goes wrong.
- Click in the SYSTEM field and type the instruction.
Write three comprehension questions about the text below. Question 1 is about a fact in the text, question 2 about the main idea, question 3 asks the student to apply something. Do not give answers.
- Press Enter and type:
Text:
- Type a forward slash
/. There is now an extra group in the list: at the top the output of LLM (the previous node), below it the User Input fields. - Choose text under LLM. That is the rewritten text.
If you choose
textunder USER INPUT, it writes questions about the original text, and you only notice when testing.
This is what a workflow is all about: the second step works with what the first one produced. You decide that order.
Your choice: the second step. Comprehension questions are one option. The same spot can also produce a word list ("Put the ten hardest words from the text in a table with a one-sentence explanation"), a three-sentence summary, a translation for a newcomer, or a readability check ("Name three sentences that are still too long"). You can also add a third step; its list then contains the output of both previous steps.
Step 6. Decide what comes out
- Click SELECT NEXT STEP and choose Output.
- Click the plus sign next to OUTPUT VARIABLE.
- Create two output variables. For each one, type the name and choose the source from the list.
| Variable Name (type) | Source (choose) |
|---|---|
rewritten_text |
LLM / text |
questions |
LLM 2 / text |
Step 7. Test
- Click Test Run at the top right. A panel with your own input fields appears on the right.
- Paste a piece of text into the field The text you want to adapt. If you have nothing to hand, use this:
Photosynthesis is the process by which plants use light, water and carbon dioxide to make glucose and oxygen. It takes place in the chloroplasts, where the pigment chlorophyll captures light energy and converts it into chemical energy.
- Under For which level choose an option, for example year 7.
- Click Start Run.
You see the nodes light up one by one as they run.
Under RESULT is the outcome: the rewritten text and the three questions. Under DETAIL and TRACING you see per step exactly what happened and how long it took.
Step 8. Publish
As long as you do not publish, your app exists only for you.
- Click Publish at the top right.
- Click Publish in the menu. At the top the status changes to published.
- Open the menu again. It now says Publish Update and the grey options have become active.
Every change you make from now on has to be published again with Publish Update. Otherwise the link keeps showing the old version.
- Click Open web app.
Your app opens as an ordinary web page with its own address. That link works without logging in, on a phone too. That is the link you give to your test partner.
The app in this guide is live at https://udify.app/workflow/VHWboGL9462eA1KI. Open it to see what you are working towards.
Checking that it worked
- Your app is in Studio with the label WORKFLOW
- The test run gives both a rewritten text and three questions
- The webapp link opens for someone else, without logging in
When things go wrong
| What you see | What is going on |
|---|---|
| Your credits drop fast | The node is still on gpt-5. Set it to gpt-5-mini |
The label reads textThe text you... |
The label field filled itself. Clear it and type again |
| The questions are about the original text | In step 5 LLM 2 was chosen instead of LLM |
| A message about temperature | The model does not support that parameter. Ignore it |
| An option stays empty | You typed without clicking in the empty box first |
| The link shows an old version | You did not click Publish Update after your change |
Make it yours
Everything above is an example: the levels, the prompts, the second step. This chapter helps you rebuild the app for your subject, your students and your style. Work from top to bottom: the first changes take five minutes, the last ones half a day.
| Change | Where | Difficulty | What you get for it |
|---|---|---|---|
| Other levels or audiences | Step 3, field level | easy | Options that describe your students |
| Other labels on the form | Step 3, Label Name | easy | A form in your words, also for colleagues who did not build the app |
| Stricter or different writing rules | Step 4, prompt | easy | Texts that resemble what you would write yourself |
| A sample text in your style in the prompt | Step 4, prompt | medium | Consistent tone, even for long texts |
| A different second step (word list, summary, translation) | Step 5, prompt | medium | An app for your lesson goal instead of ours |
| A third step that checks the questions against the level | After step 5, extra LLM | medium | A built-in check |
| An extra input field (subject, length, language) | Step 3 plus the prompts | medium | More knobs for the user, but also more to explain |
| Uploading a file instead of pasting text | Step 3, field type Single File, plus a Doc Extractor node | hard | Process worksheets and PDFs directly (see guide 5 for files as input) |
Three assignments
- Your levels, your text. Replace the four options with the groups you teach. Paste a paragraph from your own material and run the app for two levels. Put the two results side by side: what is really different? If the difference is too small, state in the prompt what you expect per level ("year 7: sentences of at most twelve words").
- Change the second step. Rebuild step 5 into something you can actually use next week: a word list, a summary for the classroom, three statements for a discussion. Also change the name of the output variable in step 6, so the output gets a sensible heading.
- Let a colleague break it. Give the link to someone who was not in the workshop and ask for three real texts. Look in Logs at what came out. Where did it go wrong? The answer is usually one extra sentence in a prompt. Change it, publish again (Publish Update), and let them try once more.
Checklist before you use your own material
- The text you paste contains no student names and no test results
- You are allowed to use the material (your own work, an open licence, or the publisher's permission)
- The model is set to gpt-5-mini and you know roughly what one run costs
- There is one owner of the app who maintains the prompts and republishes
- You have decided who gets the link: only you, your department, or students too (in that case: talk to your ICT coordinator or data protection officer first)
- Someone reads the output before it goes to students; the app produces a draft, not a lesson
And now an agent
You have just built a workflow: you decided every step. An agent works differently. You give it a goal and boundaries, and it chooses its own steps.
- Click Create and choose Create from Blank.
- Expand MORE BASIC APP TYPES and choose Agent.
The rest of the method you now know: set the model, write the instruction, test, publish.

























