Lesson 03 · Applied LLM Engineering
Tool Use & Agents
The workflow-vs-agent decision, tool descriptions as an engineering discipline, MCP as the integration seam, and the judgment to say "you don't need a multi-agent system" to a customer who wants one.
Go back to the job posting from Lesson 01. Anthropic's FDE role asks you to "deliver technical artifacts for customers like MCP servers, sub-agents, and agent skills".4 This lesson is those deliverables. Tool use is what turns a model that talks into a system that acts — looks up the customer's data, calls their APIs, files the ticket. And the single most important decision you'll make on site, over and over, is deceptively simple: does this problem need an agent at all?
Workflows vs agents: the canonical decision
Anthropic's "Building Effective Agents" — still the standard framing — draws one line through everything: workflows are systems where LLMs and tools are orchestrated through predefined code paths; agents are systems where the LLM dynamically directs its own processes and tool usage.1 In a workflow, your code decides what happens next. In an agent, the model does — it runs in a loop, calling tools, reading results, deciding the next step. The guidance that follows from it is the part customers least expect to hear: find the simplest solution possible, and only increase complexity when needed.1 Most "agent" products in production are workflows, and that's a compliment.
| Pattern | What it is | Reach for it when |
|---|---|---|
| Prompt chaining | Fixed sequence of LLM calls, each feeding the next | The task decomposes into known, ordered steps |
| Routing | A classifier call picks which specialised path handles the input | Distinct input categories need distinct handling |
| Parallelization | Several calls run at once; results are aggregated or voted on | Independent subtasks, or you want multiple takes |
| Orchestrator–workers | A lead call breaks work down and delegates to worker calls | Subtasks can't be predicted in advance |
| Evaluator–optimizer | One call generates, another critiques, loop until good | Clear evaluation criteria; iteration adds real value |
| Agent | Model directs its own tool loop until the goal is met | The path genuinely can't be enumerated up front |
So when do you actually build the agent? Four questions, all of which must come back "yes": is the task complex enough that you can't specify the steps in advance? Is it valuable enough to justify the extra tokens and latency? Is the model actually viable at this kind of task? And can errors be caught and recovered — via tests, review, or rollback?1 A "no" on any of them means you build a workflow, whatever the customer's slide deck says. This is your first AI-judgment rep in the technical stack: an invoice pipeline with five fixed steps sold as "an AI agent" is a routing workflow, and telling the customer so — with the cost and reliability argument — is the job.
Tools are prompts: the design discipline
A tool is three things: a name, a description, and a JSON
input schema.5
Here's the mental shift that separates working agents from flailing ones: the tool
description is prompt engineering. The model decides when and how to call your tool
based entirely on what you wrote there. Anthropic's tool-writing guidance reads like advice for
onboarding a new hire, because that's exactly what it is: write descriptions that say
when to use the tool, not just what it does; consolidate — a few purposeful tools beat
a thin wrapper per API endpoint; namespace related tools (clinic_search_slots, not
search2); and return meaningful, human-readable context — names and
statuses, not bare UUIDs the model can't reason about.2
The loop mechanics are simpler than they sound. You send the model a request
with your tool definitions; if it wants a tool, the response comes back with
stop_reason: "tool_use" and the arguments; your code executes the tool, appends
the result to the conversation, and calls the API again — until the model answers without
asking for a tool.5 That while-loop is an
agent. Everything else — memory, planning, sub-agents — is refinement. You'll write this loop
from scratch in today's lab precisely so it never feels like magic again.
MCP: the integration seam
Every tool you write today is welded to your own harness. The Model Context Protocol fixes that: an open standard for connecting AI applications to tools and data sources through one interface — commonly described as USB-C for AI.6 For an FDE this is the integration seam: wrap the customer's scheduling system as an MCP server once, and Claude, their IDE assistant, and next year's app can all use it. The spec also bakes in the security posture you'll need on site — user consent, explicit authorization for tool execution.7 Today you just need the concept; Lesson 07 has you building MCP servers against messy enterprise systems for real.
The Claude Agent SDK: don't rebuild the harness
Once you've written the raw loop, you'll appreciate what a harness gives you. The Claude Agent SDK packages the production agent loop — built-in file and shell tools, MCP connections, sub-agents, permission hooks, session management — as a library you call with a prompt and options.8 The FDE decision pattern: raw API + your own tools when the agent is small and the tool surface is custom (today's lab); the Agent SDK when the customer needs a capable general agent on their infrastructure fast. Knowing both — and which one a given engagement needs — is exactly the "agent development" line on your gap map.
Multi-agent: powerful, expensive, usually premature
Multi-agent systems are real — Anthropic's own Research feature runs an orchestrator that spawns parallel sub-agents, and it beat a single-agent baseline by 90% on internal research evals. But read the fine print like an FDE: agents use about 4× more tokens than chat, and multi-agent systems about 15× — so the economics only work for high-value tasks, and the architecture only pays off when the work genuinely parallelizes, like breadth-first research across independent sources.3 Sequential tasks where every step depends on the last — most coding, most form-filling, most support flows — gain little and pay everything. When a customer asks for "a team of agents," your first question is the one from this lesson's third quiz: what part of this work is actually parallel?
🧪 Practical steps: triage assistant with tools (~90 min)
Time to build. Your customer is the course's fictional virtual-care provider,
and the question their intake staff ask forty times a day is: "can nurse triage handle
this, or does it need a GP telehealth slot?" You'll build an agent that answers it by
calling real tools — a clinic-availability lookup over a small JSON dataset and a
triage-protocol search over provided text snippets. One of the three tools ships with a
deliberately bad description: you'll watch the agent fail, fix the description
using this lesson's principles, and document the before/after. That failure analysis is the
most interview-quotable part of the artifact. Full instructions and starter code are in
labs/0003-triage-agent.md.
- Set up — create
D:\Projects\FDE-Portfolio\l03-triage-agent\, copy the starter file and dataset from the lab instructions, confirmANTHROPIC_API_KEYis set andpip install anthropicis current. - Read the tool definitions first — before running anything, predict which tool the model will struggle with and why. Write your prediction down.
- Write the agentic loop — the starter marks a
TODO: loop whilestop_reason == "tool_use", execute the requested tools, returntool_resultblocks, repeat. - Run the five test questions — routing questions of increasing nastiness are in the starter. Log every tool call the model makes.
- Observe the failure — one tool has a uselessly vague description. Capture the misbehaviour concretely: wrong tool chosen, malformed arguments, or the model guessing instead of calling it.
- Fix the description — rewrite it per this lesson: say when to use it, describe each parameter, name the return format. Re-run the same five questions.
- Document before/after — in
README.md: the bad description, the observed failures, the fixed description, the new behaviour, and one paragraph justifying why this problem got an agent rather than a workflow. - Commit the artifact — code, dataset, README. This agent gets a real MCP integration in Lesson 07 and production hardening in Lesson 08 — it's a running character in your portfolio, not a throwaway.
Feedback loop: bring your README and transcript back to me in chat and I'll review it like a staff engineer would — is the workflow-vs-agent call justified, do the tool descriptions follow the principles, and is the failure analysis honest about what broke? This artifact feeds the Lesson 11 capstone engagement and is tracked in reference/artifact-tracker.html.
No chat here — this box replaces it. Copy the prompt into any AI assistant (Claude, ChatGPT, Gemini…), then paste your README and a sample run transcript after it.
You are a staff-level applied AI engineer reviewing my work: a patient-routing triage agent for a virtual-care provider, built in Python with the anthropic SDK. It uses an agentic tool-use loop over 2–3 tools (clinic availability lookup, triage protocol search). The lab included a deliberately bad tool description; I observed the failure, fixed the description, and documented before/after. Grade each criterion as Strong / Adequate / Missing, with one sentence of evidence: - Workflow-vs-agent justification: the README argues from the actual decision criteria (unpredictable paths, value, viability, recoverable errors) why this is an agent and not a routing workflow — or honestly concedes where a workflow would do. - Tool description quality: each tool description says WHEN to use the tool, documents every parameter, and the tools return human-meaningful context (names/statuses, not bare IDs). - Failure-analysis honesty: the before/after documents concrete observed misbehaviour (which calls went wrong and how), not a vague "it worked better afterwards". Be skeptical — probe the weakest criterion first. Then ask me 2–3 follow-up questions an FDE interviewer would ask about this build (e.g. how I'd eval it, what breaks at 10× tool count). Finish with the single highest-leverage improvement. My README and transcript follow below.
- Find the fake agent. Identify one process at your workplace being described (or sold) as "an AI agent" and write two sentences: is it actually a workflow, and what evidence tells you?
- Write one tool description. Pick an internal API you know and write a tool description for it as if an agent would call it — when to use it, every parameter, the return shape. Ask a colleague to critique it cold: could they use the API from your description alone?
- Run the simplicity check. Next time someone proposes an AI feature, ask (or note privately) which rung of the ladder it needs: single call, workflow, or agent — and what evidence would justify climbing higher.
Check yourself — think like an FDE
Scenarios, not recall. Diagnose from the mental model — don't scroll up. Wrong picks stay live.
Scenario A
A health-insurer customer's exec sponsor opens the kickoff with: "The board approved budget for an AI agent." The actual need: incoming claims get classified into five categories, each with a fixed handling sequence — extract fields, validate against the policy, route to the right queue. The steps never vary within a category. What do you build, and what do you tell the sponsor?
Scenario B
On site, a customer's half-built agent keeps failing: asked about
order status, it sometimes calls data_query with malformed arguments, sometimes
answers from memory without calling anything. The tool is described as "Queries the data
store" with one parameter, q (string). The team is about to swap to a bigger
model to fix it. What's your diagnosis?
Scenario C
A well-funded customer read about orchestrator–worker research systems and wants their contract-drafting assistant rebuilt as "a swarm of specialist agents" — one for clauses, one for compliance, one for tone. Drafting is strictly sequential: each section depends on the previous ones. They ask for your honest take. What is it?
Recommended learning
Hand-picked follow-ups. None are required — the primary source above comes first.
- Article How we built our multi-agent research system — Anthropic Engineering The production reality behind multi-agent hype — orchestrator-workers, the 15× token economics, and what debugging stateful agents is actually like.
- Article Agents — Chip Huyen The best vendor-neutral treatment of agent planning and failure modes — sharpens your instinct for where these systems break.
- Article MCP — Getting started — modelcontextprotocol.io The official ten-minute intro to the protocol you'll build on in Lesson 07 — enough to hold the integration-seam conversation now.
- YouTube How We Build Effective Agents — Barry Zhang, Anthropic (AI Engineer Summit) The blog post's co-thinking, live: don't build agents for everything, keep it simple, think from the agent's perspective.
- YouTube The Model Context Protocol (MCP) — Anthropic MCP's own team (incl. co-creator David Soria Parra) on why the protocol exists and where it's going — useful customer-conversation ammunition.
References
- Anthropic, "Building Effective Agents" (Dec 19, 2024) — workflows vs agents definitions; the five workflow patterns; "find the simplest solution possible"; when to build agents.
- Anthropic, "Writing effective tools for agents" (Sep 11, 2025) — tool consolidation, namespacing, meaningful context over raw IDs, descriptions as if onboarding a new hire, tool evals.
- Anthropic, "How we built our multi-agent research system" (Jun 13, 2025) — orchestrator-worker architecture; agents ≈4× and multi-agent ≈15× chat token usage; parallelizable, high-value tasks.
- Anthropic, Forward Deployed Engineer, Applied AI — job posting (2026) — "deliver technical artifacts for customers like MCP servers, sub-agents, and agent skills".
- Anthropic, Tool use overview — Claude Docs (current) — tool definition structure (name, description, input_schema), the tool_use / tool_result loop, tool_choice.
- Model Context Protocol, Introduction (current) — open protocol for connecting AI applications to tools and data sources; the USB-C analogy.
- Model Context Protocol, Specification (rev 2025-11-25) — architecture; security and trust principles: user consent, explicit tool-execution authorization.
- Anthropic, Claude Agent SDK — overview (current) — agent harness with built-in tools, MCP, subagents, hooks, permissions, sessions.
- Chip Huyen, "Agents" (Jan 7, 2025) — agent planning, tool selection, and compound-error failure modes.