Module 1 — What an agent adds, and what it costs
Before writing a single line of loop code, we need one clear picture: what an agent actually adds to a language model, and what that addition costs. The word covers three very different objects, and confusing them is the single most expensive mistake at project start.
Three objects, one word
A call is a single request to a model. Input, output, done. Predictable latency, predictable price, and a stack trace that reads left to right.
A chain is a directed sequence of calls with fixed control flow. Retrieval, then classification, then summary. Each step is a call, but the graph is known in advance — you can draw it on a whiteboard.
An agent is a loop where the model itself decides the next step. It observes, it thinks, it picks a tool, it reads the result, and it repeats until a stop condition is met. The graph is not known in advance. That single property — the model choosing what to do next — is the entire premise of the discipline, and the entire source of its cost.
The cost of autonomy, in numbers
The cost lives in three currencies you should count separately.
Tokens. A chain with three calls sends the prompt three times. An agent with ten iterations sends a growing prompt ten times: original question, plus every previous thought, plus every tool observation, plus every result. On our running example — a research agent answering one question in ten iterations — the input side inflates roughly seven-fold compared to the same task expressed as a chain. Output tokens grow more slowly, but they grow.
Latency. Each iteration is a full model call. Ten iterations at two seconds each is twenty seconds before the user sees an answer. A chain of three calls with the same total token count finishes in six.
Debuggability. A chain fails on a known step. An agent that fails at iteration seven fails because of what happened at iterations one through six, and you cannot tell without a full trace. Module 9 is entirely devoted to this.
Degrees of autonomy
Autonomy is a dial, not a switch. The useful positions on it are worth naming.
Level 0 — direct call. No agent. Use when the task fits in one prompt.
Level 1 — chain with retrieval. Fixed steps, no decisions. Use when the graph is stable and the inputs vary. This is the sweet spot for most production language-model applications.
Level 2 — agent with a closed toolset. The loop picks among three or four well-described tools. Use when the branching depends on data the developer cannot see in advance — a search whose result determines whether a second lookup is needed.
Level 3 — agent with sub-agents or open toolset. Agents that spawn agents, or that browse the web freely. Use only when the level-2 solution demonstrably fails, and expect the cost to jump by an order of magnitude.
When an agent is the wrong answer
Three symptoms should push you back toward a chain.
You already know the sequence of steps. If a whiteboard drawing captures the pipeline without arrows going backwards, an agent buys you nothing but token inflation and a stack trace you cannot read.
The task tolerates no non-determinism. Regulatory reports, invoicing, medical dosage. An agent whose decision path varies from run to run is not the right tool for a task where every run must be identical.
The failure mode is silent. An agent that "answers something" when the right answer is "I do not know" is worse than a chain that returns an explicit empty result. Level 2 requires the guardrails of module 7 to be acceptable; without them, you have built a machine that produces plausible-looking wrong answers on demand.
The running example
For the rest of this course we build a documentary watch agent for a product team. It receives a research question in one sentence, queries a public search engine and an internal knowledge base, reads pages, extracts facts, checks for contradictions between sources, and produces a note with citations. Modules 2 to 6 build it in plain Python. Module 9 rebuilds the same agent in LangGraph and compares. Module 10 wraps it into a supervised project with an evaluation set of thirty questions.
Ask "if I had a perfect intern, what exact sequence of steps would I ask them for?" If the answer is a short list without loops, build a chain. If the answer contains "then, depending on what they find, do either X or Y", an agent might earn its cost. If the answer is "I have no idea, that's what I want the model to figure out", you are about to spend a lot of money to discover that the task was ill-defined.
Summary
- A call is one model request, a chain is a fixed graph of calls, an agent is a loop where the model chooses the next step.
- The cost of autonomy is paid in tokens, latency and debuggability; count all three before starting.
- Four levels of autonomy exist; most production language-model apps live at level 1 or 2.
- An agent is the wrong answer when the sequence is known, when non-determinism is unacceptable, or when silent failures cost more than admitted ignorance.
Next module: the reasoning and acting loop, the sixty lines of Python that turn a model into an agent.