Lenny Rachitsky · 2 min read · Gen AI Tools

How to design AI agent loops: schedules, goals, and subagents in Claude Code and Codex

Read the original on lennysnewsletter.com →

Explore designing AI agent loops—defining heartbeat, cron, hook, and goal loops, when to use each, and the five essentials for production. The guide includes a practical onboarding framework and two live builds: a daily aging-PR loop in Claude Code with subagents, and a weekly skills-identification loop in Codex that validates output in real time.

Key Takeaways

Excerpt

I break down every loop type from scratch—what a heartbeat, cron, hook, and goal loop actually are, when each one fits, and the five things any effective loop needs before it touches production. Then I build two live loops: a daily aging-PR reviewer in Claude Code that schedules itself at 10:15 a.m. and spins off its own subagents, and a weekly skills-identification loop in Codex that spawns goal-based subagents to validate its own output in real time. Listen or watch on YouTube , Spotify , or Apple Podcasts What you’ll learn: The plain-English definition of a loop—and why it’s just…

Back to Product Lattice Feed