Module 2 · Phase 1: Foundations from raw APIs · Weeks 3–5

The Agent Loop

An agent is an LLM calling tools in a loop, with the model deciding what to do next. This module is the heart of the curriculum: the loop itself, ReAct, Anthropic's workflows-vs-agents taxonomy, planning, termination, budgets, and failure recovery.

After this module you can
  • Implement the core agent loop — model picks a tool, you execute, results feed back — with the model choosing the path
  • Explain Anthropic's workflows-vs-agents taxonomy and argue when a workflow beats an agent (the interview staple)
  • Implement the five workflow patterns: prompt chaining, routing, parallelization, orchestrator-workers, evaluator-optimizer
  • Explain ReAct and how native tool calling absorbed it; add upfront planning and re-planning to a loop
  • Enforce termination with layered guards: finish tool, max iterations, cost budget, wall-clock deadline — with graceful degradation
  • Recover from tool failures without crashing, keep context from exploding across iterations, and emit a JSONL trace log for every run

Lessons

Best external resources

Curated reading, docs, and tools that pair with this module.