Build an agent that calls tools
Give an app the ability to act, not just answer
The last of Dify's three app types is the Agent. Where a Chatbot answers and a Workflow runs a fixed graph, an Agent decides which tools to call to reach a goal. Tools are one of the canvas node types, and an Agent app can reach for them dynamically. This lesson builds an agent that uses a tool plus your knowledge base.
- 1 In the Studio, click Create App → Agent.
- 2 Attach your knowledge base so the agent can ground its answers.
- 3 Enable at least one Tool for the agent (Dify offers built-in and connectable tools).
- 4 Give the agent a goal-shaped prompt, e.g.
Find the relevant finding in my documents and check it against an external source. - 5 Run it and watch the agent choose when to read its knowledge base and when to call the tool.
An Agent app completed a goal by combining your knowledge base with at least one tool call, visible in its reasoning trace.
Agent vs Workflow — who decides the steps
Agents and Workflows look similar but differ on one axis: control. Knowing which to reach for keeps you from over-engineering a simple task or under-powering a complex one.
In a Workflow YOU decide the path — the graph of nodes is fixed and the same every run. In an Agent, the MODEL decides which tools to call and in what order to reach the goal, so the path can differ run to run. Tools are what give an agent reach beyond text — and because all three app types (Chatbot, Agent, Workflow) publish the same way, an agent you build is also a public chat URL, an embeddable widget, and a Service API endpoint (Dify's own chat-messages endpoint, called with the app's API key).
- ?For your own research task, is the sequence of steps fixed (Workflow) or does it depend on what the model finds (Agent)?
- ?What could go wrong when the model, not you, decides which tool to call?
- ?How would you constrain an agent so it cannot take an action you do not want?
Decide Chatbot, Workflow, or Agent for a real task
You have now built all three app types. The skill that outlasts this course is choosing the right one — and being able to defend the choice.
Take a genuine task from your work and specify which Dify app type fits it, the nodes or tools it would need, and how you would publish it.
- 1 Write the task in one sentence (what comes in, what should come out).
- 2 Choose Chatbot, Workflow, or Agent and justify it in one line using the control distinction from this lesson.
- 3 List the nodes or tools it would use (from the node vocabulary you have learned).
- 4 State how you would deliver it: public chat URL, embedded widget, or Service API.
A one-paragraph spec naming the app type, the nodes/tools, and the delivery surface for a real task of your own.