Episode
How to design AI agent loops: schedules, goals, and subagents in Claude Code and Codex
- Podcast
- How I AI
- Published
- Jun 17, 2026
- Duration seconds
- 1746
- Processing state
processed
Actions
POST https://stenobird.com/v1/public/podcasts/how-i-ai-7304222/episodes/how-to-design-ai-agent-loops-schedules-goals-and-subagents-in-claude-code-and-codex/transcription-requests
Idempotently request low-priority transcript generation for this episode.GET https://stenobird.com/podcast/how-i-ai-7304222/how-to-design-ai-agent-loops-schedules-goals-and-subagents-in-claude-code-and-codex.md
Read the agent-friendly Markdown representation of this episode resource.
Summary
Move beyond simple prompting by designing autonomous AI agent loops that can trigger, execute, and validate their own work. Learn to implement heartbeat, cron, hook, and goal-based loops using Claude Code and Codex.
Topics
- AI Agents
- Claude Code
- Codex
- Loop Engineering
- Automation
- Software Engineering
- Prompt Engineering
- Subagents
Highlights
- Main idea: Transition from manual prompting to autonomous loops where agents trigger themselves via schedules or events
- Practical takeaway: Use the 'onboarding an employee' mental model to design loops with work trees, skills, and state tracking
- Failure mode: Goal-based loops can rapidly burn tokens if validation criteria are too thin or imprecise
- Technical pattern: Implement 'heartbeat' and 'cron' loops for routine tasks like daily PR reviews or morning briefings
- Advanced technique: Use subagents within loops to perform real-time validation and complex task decomposition
Chapters
3:00Defining the AI Loop: An explanation of how loops differ from standard human-triggered prompts and the various ways agents can be triggered.5:00The Four Loop Types: A breakdown of heartbeat, cron, hook, and goal-based automation patterns.7:00Foundational Loop Requirements: The essential components every effective loop needs, including connectors, plugins, and subagents.10:00The Employee Onboarding Framework: How to design agent workflows using a mental model of delegating tasks to a new hire.14:00Build 1: Automated PR Reviewer: A live demonstration of a Claude Code routine that monitors aging Pull Requests and alerts teams via Slack.20:00Build 2: Goal-Based Skill Identification: Using Codex to create a loop that analyzes code commits to identify and validate new engineering skills.25:00Warning Signs and Token Management: How to avoid expensive loops and the importance of precise evaluation criteria in goal-based prompting.