Agent Systems · advanced
Agent Loops
The plan → act → observe loop, with memory and stopping conditions.
Mental model
An agent is a loop: the model proposes an action, a tool executes it, the observation re-enters context, repeat until done. The engineering is in the guardrails — step limits, memory, and human approval — not the prompt.
How to study Agent Loops
Begin by restating the mental model in your own words, then connect it to a concrete system you have built or operated. Name the mechanism, the constraint it addresses, and the trade-off it introduces. Use Building Effective AI Agents (Anthropic Engineering), ReAct: Synergizing Reasoning and Acting in Language Models, Reflexion: Language Agents with Verbal Reinforcement Learning to check details, but close the source before writing your explanation. Retrieval is the learning step; rereading is only preparation.
Next, compare Agent Loops with Context Packing, LLM Evals. Ask what changes in correctness, latency, resource use, operability, and failure recovery. Complete Cap agent tool loop and preserve the command, input, output, and one failed attempt as evidence. Finish by explaining the idea without jargon to someone who has not studied the track.
Proof of understanding
- Explain the mechanism from first principles and identify the state it reads or changes.
- Give one situation where the concept is the right choice and one where it is not.
- Predict a realistic failure mode before running the drill, then compare the prediction with evidence.
- Connect the result to a roadmap or build artifact instead of treating the concept as isolated trivia.
Where it matters
Coding agents, research agents, Aliveville's agent world.
Common mistakes
- No step limit, so the loop runs away
- Letting context grow unbounded across iterations
- No human approval gate for irreversible actions
Learn from primary sources
Practice and explain it back
Cap agent tool loop
Agent calls tools in a loop. Max 5 steps, same tool 2× in a row triggers stop. Steps: search, search, calc, search, search, calc. When stop?
Expected evidence: Stop at step 3 (duplicate search) or step 5 by max steps — implement both guards.
Open the interactive drill →Review prompts
- What guardrails keep an agent loop from running away?
Build evidence
Synthesize: Agent Systems
Engineer useful agents with bounded loops, tools, memory, protocols, durability, permissions, and long-running control. Produce one working system, benchmark, or evidence-backed design that integrates the path.
- Implements or precisely models the core mechanisms from all three milestones
- Includes at least one injected failure or adversarial case and demonstrates recovery
- Reports quality, latency, resource, reliability, or usability measurements relevant to the domain
- Ships a concise architecture note explaining decisions, trade-offs, and remaining risks