Agent Loops and Planning — AI Engineering: Building Production LLM Applications — Hackademy