पाठ 19 / 25
Agent Nodes and Tool Use
Let the model choose actions, with limits.
Reason, call a tool, observe, repeat
An agent (an agent app or an agent node inside a workflow) gives a model a goal, instructions and a set of tools, and lets it decide which tools to call in a loop until it can answer, using strategies such as function calling or ReAct. Agents are flexible for open-ended tasks but less predictable than fixed workflows. Limit the tools to what the task needs, set a maximum number of iterations, require approval for actions that change data, and log every tool call. If the steps are always the same, a fixed workflow is better. Dify's node names, menus and options change between versions; check the current Dify documentation.
Workflow or agent?
Prefer the more predictable option when it works.
situation choose
steps are always the same workflow (fixed graph)
few known branches workflow + if/else / classifier
open-ended research across several tools agent with iteration limit
actions that change data workflow, or agent + approval stepSet an iteration limit
A maximum number of agent steps prevents runaway loops and surprise costs.
त्वरित जाँच: When is a fixed workflow better than an agent?
- Never
- When the task is completely open-ended
- When you want less predictability
- When the steps are known and always the same
Answer
When the steps are known and always the same — Predictability is valuable.