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

How I AI
Jun 17
This episode explores the shift from manual prompting to automated AI agent loops, breaking down how to design and implement them for recurring tasks. The host explains the core concepts and then demonstrates two live builds, showing how these loops can autonomously manage workflows like code review and skills identification.
The podcast defines a loop as an automated prompt, categorizing them into four types: heartbeat, cron, hook, and goal loops. Effective loops require five components: work trees, skills, plugins, subagents, and state tracking. The host uses an 'onboarding an employee' framework to design loops for recurring jobs. Two live builds are presented: a daily aging PR review loop in Claude Code that schedules itself and uses subagents to babysit pull requests, and a weekly skills-identification loop in Codex that spawns goal-based subagents to validate its own output. The discussion highlights that goal-based loops are the most challenging to write precisely, and warns that poorly designed loops can become expensive by burning tokens without producing useful results.
00:00
00:00
Prompts are outdated, loops are the new trend
02:30
02:30
A loop is a way to prompt an AI agent.
03:03
03:03
These loops automate prompting so agents can work autonomously.
06:04
06:04
Five components for effective AI agent loops
09:26
09:26
Designing AI loops is like onboarding an employee.
14:54
14:54
The loop runs at 10:15 AM, checks for PRs open over 12 hours
17:08
17:08
Autonomous subagents babysit PRs until merge checks pass
19:00
19:00
Loop-based prompting can schedule teams to work iteratively until completion.
22:57
22:57
A weekly loop spawns sub-agents to validate new skills.
27:00
27:00
Goal-based loops require very precise prompting.
27:31
27:31
Use agents with schedules or goals and leave them to work autonomously