Stage 7 · Lesson 1 of 5
How an agent works through a task
An agent runs a loop: read the task, choose a tool (read a file, search, edit, run a command), look at the result, decide the next step, and repeat until it judges the task done. It is powerful because it gathers its own context and checks its own work, and risky for the same reasons: it acts on its guesses, and each step builds on the last.
Knowing the loop tells you where to steer. Give it a good start: a spec, the right files and a check to run. Watch the first few steps; if it heads the wrong way, stop it early, since redirecting after two steps is cheap and after twenty is not. For multi-file changes, ask for a plan first.
Common trapwalking away from a long task with no check it must pass, then finding it finished something else.
A question to check yourself, an AI practice session and 1 cheat sheet entry come when you add the roadmap to your account. Add it
Resources for this stage
Start with
- GuideFreeBuilding Effective Agents
Anthropic · Advanced
Anthropic's clear, free essay on how agents work and when simpler workflows are better
Keep handy
Also worth your time
Permission levels, auto-approval risks, sandboxing and the security baseline for agents
- OWASP Top 10 for LLM ApplicationsGo deeper
Prompt injection and excessive agency explained by the security community