Module 87: Agents and Tool Calling
Workflows and agents
🏠The everyday picture
A recipe gives fixed steps: you know what happens and in what order. A head chef handling a new dish decides the steps as they go. Both are useful; the recipe is more predictable.
📘What it really is
- Workflow: your code fixes the steps, and the model does specific parts. For example: classify the enquiry (model) → look up the customer (code) → draft a reply (model) → a person approves (human) → send (code).
-
predictable, easy to test, cheaper; best for most business processes.
-
Agent: the model decides which tools to use, in what order, and when it's done, within limits you set.
- flexible for open-ended tasks ("find out why this customer's orders dropped and suggest actions");
-
less predictable, harder to test, can take more steps and cost more; mistakes can compound.
-
Start with the simplest thing that works: a single model call, then a workflow, and only then an agent, if the task really needs open-ended exploration and mistakes can be caught and recovered (tests, review, undo).
-
Common workflow patterns:
- chaining: one step's output feeds the next;
- routing: classify the request, then send it to the right specialised prompt or tool;
- parallel: do several independent checks at once and combine them;
-
evaluator: one step drafts, another checks against criteria.
-
Agents need guardrails: step limits, cost limits, timeouts, a small set of tools, approval for actions (Lesson 5) and full logs of every step.
🖱️Try it
Design your enquiry-handling flow as a workflow on paper: list each step and mark it model, code or human. Then write one task where an agent would genuinely help in your CRM, with its tools and limits. Implement only the workflow for now.
✅Quick check
What's the main difference between a workflow and an agent?
Show the answer
In a workflow, code fixes the steps; in an agent, the model chooses the steps within limits.
When should you prefer a workflow?
Show the answer
When the process is known in advance; it's more predictable, testable and cheaper.
