Self-correction in AI agents only works when grounded in external verification signals, not the model's own judgment. This tutorial builds a complete code-generation agent using Claude and LangGraph that writes Python functions, runs pytest to verify them, feeds real test failures back as feedback, and enforces a bounded retry budget. A consistency-based confidence gate generates a second independent solution and checks agreement before shipping. When the retry budget is exhausted, the system escalates cleanly with a full failure log rather than retrying indefinitely. Key building blocks covered include reflection loops, grounded verifiers, confidence scoring limitations, retry policies with exponential backoff, and recovery architecture analogous to dead-letter queues.