← Fig. 1 — one request, end to end
Agents and Tool Use
Giving a model hands, and keeping them on a leash.
Fig. 2 — Tool loop, detail at larger scale
The loop out to tools and back.
Key plan — part 4 on Fig. 1Figure 2 — the parts of this course, as links to their lessons
What the detail shows
- A run can start with a person typing, or on a schedule, with nobody there to ask.
- The tools are described to the model as text, and go into the context window with everything else. There are four of them, not thirty.
- The request runs through the model to one decision: stop, or call a tool.
- If it calls, a dashed path leaves the decision and passes through the tool’s schema — a closed set of fields the call has to fit.
- The tool runs. A dashed line from it up through an approval gate is the only place on the sheet where anything touches the real world.
- The result comes back along the return line into the context window. The ticks on it are the turns, and the solid bar across it is the limit that ends a runaway.
- A call that failed is struck through. It is still a result, so a short path takes it back into the tool to try again.
- The bars hanging off the return are the transcript: one line longer every turn.
- Two dotted taps watch and carry nothing — one reads what a turn cost, which climbs over a long run, and one writes down what each step did.
- The two weak diamonds under the model are the same agent split in five, each copy paying for its own context.
- When the model stops instead of calling, the answer leaves on the right.
Schedule of lessons
14 lessons
- The shape of an agent
3 lessons · 21 min
- A loop, not a brain
One question separates an agent from a script, and most production systems should stay on the boring side of it.
- How a model picks a tool
Your tools arrive at the model as text, and the description does more work than every type in the schema.
- Designing a tool a model can actually use
Close the schema, narrow the values, name it for the job — and ship four tools instead of thirty.
- A loop, not a brain
- Running the loop
5 lessons · 37 min
- Planning a run, and knowing when to stop
Reason, act, observe, repeat - and the line nobody writes, which is the one that ends it.
- When a tool call goes wrong
A failed tool result is an input to the next step, not the end of the request - so decide what the next step should be.
- Testing an agent without the model in the loop
The model's wording never repeats exactly twice. The loop around it is ordinary code, and ordinary code can be pinned down and checked.
- What the loop remembers within one run
The transcript is not memory. It is a queue that gets more expensive and less useful the longer it gets.
- What sticks around after the run ends
Memory across sessions is a database you let a language model write to, with no review step.
- Planning a run, and knowing when to stop
- Reaching outside
3 lessons · 23 min
- One protocol instead of forty integrations
MCP standardises how a tool is described, listed and called — and deliberately says almost nothing about whether it is safe or any good.
- Letting an agent touch the real world
Sandboxing and permissions: you cannot stop the agent making a bad call, so decide in advance how bad the worst call is allowed to be.
- When nobody is watching
A synchronous agent has a human to ask when something's wrong. A scheduled one has to decide everything in advance, because nobody is there to ask.
- One protocol instead of forty integrations
- Running it at scale
3 lessons · 22 min
- When one agent becomes five
Splitting one agent into several cuts its context into pieces, and you pay for every piece on every step.
- Why the bill exploded
A loop re-reads its whole past on every step, so cost grows with the square of the run, not with the task.
- Reading a trace after it breaks
The run finished, nothing raised, and the answer is wrong — so the only evidence you have is what each step did.
- When one agent becomes five
Notes
An agent is a model, a loop, and a set of functions it is allowed to call. How the model decides which tool to reach for, what happens when a call fails mid-run, and what an agent should never be allowed to touch.
Every figure on this sheet is counted from the lessons themselves. Your progress is kept in this browser only — no account, nothing sent anywhere.