6

Chapter Six

Building
Agents

The difference between a calculator
and a coworker.

A chatbot waits for you to speak. An agent doesn't. Give it a goal — "research Mars colonization and write a report" — and it breaks the work into steps, picks the right tools, executes them one by one, checks its own results, and keeps going until the job is done. That distinction — between responding to instructions and pursuing a goal — is the difference between a calculator and a coworker.

Agents run on a loop: receive a goal, plan steps, execute with tools, observe results, evaluate progress, adjust. They don't plan once and execute blindly — the best ones recover gracefully when step three goes sideways. But that power has a dark side: agents don't just give bad answers, they act on them, then use the broken result to make the next decision. Failures compound.

The Agent Loop

Every agent runs on the same five-step cycle. Understanding these steps is the difference between building something useful and building something that burns through your API credits in an infinite loop.

G

Goal

Receive a clear objective. "Research Mars" isn't a goal. "Write a 500-word summary of Mars colonization challenges, with sources" is.

P

Plan

Break the goal into concrete steps. Good planners create flexible plans. Bad planners create rigid scripts that shatter at the first surprise.

T

Execute

Run each step using the right tool — search engines, code interpreters, file readers, APIs. Agents don't just think. They act.

M

Observe

Record what happened and check results. Without memory, an agent might repeat the same failing action forever.

E

Evaluate

Did this work? Am I closer to the goal? If something's off, adjust the plan and loop again. This is what separates an agent from a script.

Key insight

A chatbot is a single turn. An agent is a whole conversation — with itself, its tools, and the world. The best agent builders don't maximize autonomy. They design thoughtful checkpoints where the agent pauses and lets a human decide whether to continue.

Time to build one. Design a tank agent — pick its capabilities, allocate its budget, and write its strategy — then deploy it to the arena and watch it fight autonomously.

Agent Arena
Configure

Capabilities

5 pts left
Armor
2
Speed
2
Power
2
Rate
2
Range
2

Strategy (system prompt)

Close distance. Fire constantly. Prioritize damage over survival.

Opponent

Share this course
The goal isn't to prevent all failure — it's to make failure recoverable.

Next up: you'll use a real agent — one that reads your code, writes changes, runs tests, and fixes its own mistakes. Meet Claude Code.

Agent Swarm

New tool unlocked!